From aa424cf9ab2471619c19c256643a39b217c13e5b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 21 Sep 2025 16:10:38 +0000 Subject: [PATCH] feat: Add ArcanistBuildableWorkflow for buildable summary Co-authored-by: wua --- src/__phutil_library_map__.php | 2 + src/workflow/ArcanistBuildableWorkflow.php | 85 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 src/workflow/ArcanistBuildableWorkflow.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 81a61516e..8f03badd6 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -42,6 +42,7 @@ 'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistBraceFormattingXHPASTLinterRuleTestCase.php', 'ArcanistBranchWorkflow' => 'workflow/ArcanistBranchWorkflow.php', 'ArcanistBrowseWorkflow' => 'workflow/ArcanistBrowseWorkflow.php', + 'ArcanistBuildableWorkflow' => 'workflow/ArcanistBuildableWorkflow.php', 'ArcanistBuildPlanRef' => 'ref/ArcanistBuildPlanRef.php', 'ArcanistBuildRef' => 'ref/ArcanistBuildRef.php', 'ArcanistBuildableNotPassingException' => 'exception/usage/ArcanistBuildableNotPassingException.php', @@ -571,6 +572,7 @@ 'ArcanistBraceFormattingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistBranchWorkflow' => 'ArcanistFeatureWorkflow', 'ArcanistBrowseWorkflow' => 'ArcanistWorkflow', + 'ArcanistBuildableWorkflow' => 'ArcanistWorkflow', 'ArcanistBuildPlanRef' => 'Phobject', 'ArcanistBuildRef' => 'Phobject', 'ArcanistBuildableNotPassingException' => 'ArcanistUsageException', diff --git a/src/workflow/ArcanistBuildableWorkflow.php b/src/workflow/ArcanistBuildableWorkflow.php new file mode 100644 index 000000000..e24c6f468 --- /dev/null +++ b/src/workflow/ArcanistBuildableWorkflow.php @@ -0,0 +1,85 @@ + array( + 'param' => 'id', + 'help' => pht('Differential revision ID (e.g. 123 or D123).'), + ), + 'phid' => array( + 'param' => 'phid', + 'help' => pht('Differential revision PHID (e.g. PHID-DREV-...).'), + 'conflicts' => array( + 'id' => pht('Specify either --id or --phid, but not both.'), + ), + ), + ); + } + + public function run() { + $revision_id = $this->getArgument('id'); + $revision_phid = $this->getArgument('phid'); + + if (!$revision_id && !$revision_phid) { + throw new ArcanistUsageException( + pht('Specify either --id or --phid.')); + } + + if ($revision_id) { + $revision_id = $this->normalizeRevisionID($revision_id); + if (!ctype_digit((string)$revision_id)) { + throw new ArcanistUsageException( + pht('Revision id must be a numeric value like 123 or D123.')); + } + $params = array('revisionID' => (int)$revision_id); + } else { + $params = array('revisionPHID' => (string)$revision_phid); + } + + $result = $this->getConduit()->callMethodSynchronous( + 'harbormaster.getbuildablesummary', + $params); + + echo json_encode($result)."\n"; + + return 0; + } +} +