@open-mercato/cezar 0.19.0-pr2187.5245 → 0.19.0-pr2191.5250

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 (103) hide show
  1. package/dist/contract/github.d.ts +2 -0
  2. package/dist/contract/index.js +1 -1
  3. package/dist/server/forge/github.d.ts +8 -2
  4. package/dist/server/forge/github.js +75 -14
  5. package/dist/server/forge/github.js.map +1 -1
  6. package/dist/server/forge/types.d.ts +1 -1
  7. package/dist/server/server.d.ts +62 -62
  8. package/package.json +4 -4
  9. package/web/dist/assets/{agent-task-pickers-DUqSQDor.js → agent-task-pickers-MLQzuW0-.js} +1 -1
  10. package/web/dist/assets/{alert-dialog-BMjo8xQG.js → alert-dialog-BmRL1Z48.js} +1 -1
  11. package/web/dist/assets/arrow-left-ChBQzTmG.js +1 -0
  12. package/web/dist/assets/{arrow-up-DDpMEXPX.js → arrow-up-CTnNRWMI.js} +1 -1
  13. package/web/dist/assets/{assets-view-DJFhl-WQ.js → assets-view-DiG-TYGC.js} +1 -1
  14. package/web/dist/assets/{automation-format-AGDCMMpa.js → automation-format-dGW1rpmN.js} +1 -1
  15. package/web/dist/assets/{automations-route-fZhQTwH6.js → automations-route-DxpaO661.js} +1 -1
  16. package/web/dist/assets/{bot-DHGe6SWG.js → bot-DrK6Sgko.js} +1 -1
  17. package/web/dist/assets/{button-DEKLgKmf.js → button-NbZylHkU.js} +1 -1
  18. package/web/dist/assets/{centered-state-BphcaI7f.js → centered-state-BPIGL9iJ.js} +1 -1
  19. package/web/dist/assets/check-DvPBoeYK.js +1 -0
  20. package/web/dist/assets/chevron-left-BCx4FnUj.js +1 -0
  21. package/web/dist/assets/chevron-right-CT6Fnpf_.js +1 -0
  22. package/web/dist/assets/circle-check-Dcn22DQo.js +1 -0
  23. package/web/dist/assets/{collapsible-y9_JOH8O.js → collapsible-CDKXz_O8.js} +1 -1
  24. package/web/dist/assets/{commit-list-BnJ_KtrW.js → commit-list-GW35duqN.js} +1 -1
  25. package/web/dist/assets/{compare-variants-D-YQDVWc.js → compare-variants-DyUNkiWU.js} +1 -1
  26. package/web/dist/assets/{dashboard-BOoHWslq.js → dashboard--FKTyL2X.js} +1 -1
  27. package/web/dist/assets/{diff-BTX8_hnf.js → diff-TBw1HmxE.js} +2 -2
  28. package/web/dist/assets/{diff-stat-iPS1aFc4.js → diff-stat-NMukqBvW.js} +1 -1
  29. package/web/dist/assets/{diff-view-D_Ed-_6s.js → diff-view-BqiVB8yC.js} +1 -1
  30. package/web/dist/assets/{dist-BL82fgXB.js → dist-D224VWvi.js} +1 -1
  31. package/web/dist/assets/{download-BBcE6du0.js → download-B0rY5kiv.js} +1 -1
  32. package/web/dist/assets/{dropdown-menu-9pfVDQIS.js → dropdown-menu-Cfb0zPli.js} +1 -1
  33. package/web/dist/assets/{external-link-B9I9h6zs.js → external-link-bE6WHHRh.js} +1 -1
  34. package/web/dist/assets/{facet-filter-Cvm-6l7b.js → facet-filter-LSZuECFU.js} +1 -1
  35. package/web/dist/assets/{file-BnJ8Tzsg.js → file-DPaRiZmR.js} +1 -1
  36. package/web/dist/assets/{file-preview-CP4j_vl5.js → file-preview-CLO4sY9B.js} +1 -1
  37. package/web/dist/assets/{file-tree-8U32zDd-.js → file-tree-hs-Eglan.js} +1 -1
  38. package/web/dist/assets/{folder-CytN1Yo8.js → folder-DcV5QNvl.js} +1 -1
  39. package/web/dist/assets/{follow-up-engine-Ce9k7tYF.js → follow-up-engine-DW-IRFeD.js} +1 -1
  40. package/web/dist/assets/{git-pull-request-DMo_7DFy.js → git-pull-request-CWBEvjAt.js} +1 -1
  41. package/web/dist/assets/{git-pull-request-draft-BMkmZz6D.js → git-pull-request-draft-DPPI9stN.js} +1 -1
  42. package/web/dist/assets/{git-tab-loading-B_kOqZw9.js → git-tab-loading-sgogJFfW.js} +1 -1
  43. package/web/dist/assets/{github-Y4GAdDuW.js → github-2BGxMXcs.js} +1 -1
  44. package/web/dist/assets/{host-usage-Blc4XuJC.js → host-usage-C9AaMS6z.js} +1 -1
  45. package/web/dist/assets/{icon-tooltip-xYeXiKnP.js → icon-tooltip-F4PGkUfv.js} +1 -1
  46. package/web/dist/assets/{impact-control-CYWqjBeZ.js → impact-control-BTRY94Sh.js} +1 -1
  47. package/web/dist/assets/{impact-model-w3m0JqTh.js → impact-model-1CWMp5eL.js} +1 -1
  48. package/web/dist/assets/{index-Bim_jMGF.js → index-bT3jIZpR.js} +4 -4
  49. package/web/dist/assets/{input-BD-Stab_.js → input-DLGEW9sG.js} +1 -1
  50. package/web/dist/assets/{layout-cards-Banu0pif.js → layout-cards-BzpHZt7s.js} +1 -1
  51. package/web/dist/assets/loader-circle-BUeR5Ufi.js +1 -0
  52. package/web/dist/assets/{markdown-BtT0eMoy.js → markdown-Bu49q-aW.js} +1 -1
  53. package/web/dist/assets/{markdown-DLSPDIgM.js → markdown-DTJ2-YBk.js} +1 -1
  54. package/web/dist/assets/{message-square-CFnbWDwJ.js → message-square-DX3ZWup9.js} +1 -1
  55. package/web/dist/assets/{picker-pill-Db_cc08W.js → picker-pill-h-wTnpr_.js} +1 -1
  56. package/web/dist/assets/plus-D29Ppfva.js +1 -0
  57. package/web/dist/assets/{project-router-B25WtOd0.js → project-router-CL-07LOx.js} +1 -1
  58. package/web/dist/assets/{queries-SXr7UH2d.js → queries-DnsNcag9.js} +1 -1
  59. package/web/dist/assets/{reasoning-effort-pill-BT5JgCzI.js → reasoning-effort-pill-w6dDzJid.js} +1 -1
  60. package/web/dist/assets/{repo-git-BwMJr8WR.js → repo-git-CDlCDwiC.js} +1 -1
  61. package/web/dist/assets/{run-diff-D9cHFzEp.js → run-diff-BgdizE97.js} +1 -1
  62. package/web/dist/assets/{save-BvNImrT_.js → save-CA1uH6sn.js} +1 -1
  63. package/web/dist/assets/{scroll-within-Bw2EOT3w.js → scroll-within-BRmwe-zF.js} +1 -1
  64. package/web/dist/assets/search-193em533.js +1 -0
  65. package/web/dist/assets/{search-x-B5WQOGxd.js → search-x-DHZ9lfef.js} +1 -1
  66. package/web/dist/assets/{settings-2-Du_u3WUT.js → settings-2-Brdk1kJ4.js} +1 -1
  67. package/web/dist/assets/{sheet-BHrzxKUa.js → sheet-BdZzurHe.js} +1 -1
  68. package/web/dist/assets/{skills-DVAMF9vT.js → skills-B3KqYud_.js} +1 -1
  69. package/web/dist/assets/{square-QzJ9-phT.js → square-3vRF-SNj.js} +1 -1
  70. package/web/dist/assets/{tabs-Be68Aqa2.js → tabs-BreBDYGQ.js} +1 -1
  71. package/web/dist/assets/{tag-D04GM0QQ.js → tag-BA7RBNdm.js} +1 -1
  72. package/web/dist/assets/{task-commits-BgNk6lcj.js → task-commits-ZBDnpZQF.js} +1 -1
  73. package/web/dist/assets/{task-graph-BBPeT1Qi.js → task-graph-vP7va7eL.js} +1 -1
  74. package/web/dist/assets/{task-notes-Drlr129V.js → task-notes-BofhNHvq.js} +1 -1
  75. package/web/dist/assets/{task-workspace-C2RhmQ8X.js → task-workspace-C2xoXLA5.js} +3 -3
  76. package/web/dist/assets/terminal-Bc2YqB0l.js +1 -0
  77. package/web/dist/assets/{terminal-drawer-Cq4lD_aH.js → terminal-drawer-CV9wo5NS.js} +1 -1
  78. package/web/dist/assets/{terminal-pane-Dkj-n0Sv.js → terminal-pane-ChguT6gs.js} +1 -1
  79. package/web/dist/assets/{textarea-CIman6oH.js → textarea-DCuPLfCC.js} +1 -1
  80. package/web/dist/assets/{toaster-CE_1rqAq.js → toaster-Cpvrjbjv.js} +1 -1
  81. package/web/dist/assets/{token-metrics-97NtLcbt.js → token-metrics-_iKCa9E7.js} +1 -1
  82. package/web/dist/assets/{tooltip-CqaFwWh4.js → tooltip-DlXMw3Yr.js} +1 -1
  83. package/web/dist/assets/{tracker-Ck46g72w.js → tracker-3I4ifm9e.js} +1 -1
  84. package/web/dist/assets/{triangle-alert-oqwl_X9W.js → triangle-alert-CEIIrgDH.js} +1 -1
  85. package/web/dist/assets/{upload-DWJUmf3k.js → upload-CM_PFVvz.js} +1 -1
  86. package/web/dist/assets/{use-now-g24574wK.js → use-now-DMNSifEK.js} +1 -1
  87. package/web/dist/assets/{use-submit-shortcut-mQeH0ZBS.js → use-submit-shortcut-DD0PG_bG.js} +1 -1
  88. package/web/dist/assets/utils-D8W8TPIp.js +60 -0
  89. package/web/dist/assets/{workflow-graph-Bc4h10S1.js → workflow-graph-DOwE2w1U.js} +1 -1
  90. package/web/dist/assets/{worktree-lifecycle-operation-AhaYwnJA.js → worktree-lifecycle-operation-CMymu1Ib.js} +1 -1
  91. package/web/dist/assets/x-BolL9Y4J.js +1 -0
  92. package/web/dist/index.html +50 -50
  93. package/web/dist/assets/arrow-left-BEAlXA3d.js +0 -1
  94. package/web/dist/assets/check-CnXMnT3w.js +0 -1
  95. package/web/dist/assets/chevron-left-BDTKSpOR.js +0 -1
  96. package/web/dist/assets/chevron-right-V6O6uOQ1.js +0 -1
  97. package/web/dist/assets/circle-check-C1XDWUmf.js +0 -1
  98. package/web/dist/assets/loader-circle-B4o_mGGx.js +0 -1
  99. package/web/dist/assets/plus-3r-g4vO6.js +0 -1
  100. package/web/dist/assets/search-DdSsYN9s.js +0 -1
  101. package/web/dist/assets/terminal-zaJwNSdq.js +0 -1
  102. package/web/dist/assets/utils-hmDT0E5u.js +0 -55
  103. package/web/dist/assets/x-UK9jvTdu.js +0 -1
@@ -488,6 +488,7 @@ export declare const githubPrMergeStateSchema: z.ZodObject<{
488
488
  reviewDecision: z.ZodEnum<{
489
489
  approved: "approved";
490
490
  "changes-requested": "changes-requested";
491
+ "not-required": "not-required";
491
492
  "review-required": "review-required";
492
493
  unknown: "unknown";
493
494
  }>;
@@ -558,6 +559,7 @@ export declare const githubPrMergeStateResponseSchema: z.ZodDiscriminatedUnion<[
558
559
  reviewDecision: z.ZodEnum<{
559
560
  approved: "approved";
560
561
  "changes-requested": "changes-requested";
562
+ "not-required": "not-required";
561
563
  "review-required": "review-required";
562
564
  unknown: "unknown";
563
565
  }>;
@@ -1120,7 +1120,7 @@ var githubPrMergeStateSchema = z11.object({
1120
1120
  baseRef: z11.string(),
1121
1121
  headSha: z11.string(),
1122
1122
  mergeable: z11.enum(["mergeable", "conflicting", "unknown"]),
1123
- reviewDecision: z11.enum(["approved", "changes-requested", "review-required", "unknown"]),
1123
+ reviewDecision: z11.enum(["approved", "changes-requested", "review-required", "not-required", "unknown"]),
1124
1124
  checks: z11.array(githubPrCheckSchema),
1125
1125
  /**
1126
1126
  * How much of the check tier the forge token could read (#969). `detailed` = one row per check;
@@ -684,10 +684,16 @@ export declare function commentOnPr(repoRoot: string, number: number, body: stri
684
684
  export declare function detectGithubCached(repoRoot: string): ForgeAvailability | null;
685
685
  /** The single row an `aggregate` check tier collapses to — see `ForgePrMergeState['checksTier']`. */
686
686
  export declare const AGGREGATE_CHECK_NAME = "All checks";
687
- export declare function normalizeMergeState(raw: unknown, policyRaw: unknown, requirements?: {
687
+ /**
688
+ * The base branch's merge rules, from classic branch protection AND repository rulesets.
689
+ * `reviewsRequired` is `false` only when both sources were read and neither asks for a review.
690
+ */
691
+ export type MergeRequirements = {
688
692
  readable: boolean;
689
693
  requiredChecks: string[];
690
- }, checkTier?: {
694
+ reviewsRequired?: boolean;
695
+ };
696
+ export declare function normalizeMergeState(raw: unknown, policyRaw: unknown, requirements?: MergeRequirements, checkTier?: {
691
697
  tier: ForgePrMergeState['checksTier'];
692
698
  reason?: string;
693
699
  }): ForgePrMergeState;
@@ -2772,13 +2772,18 @@ export function normalizeMergeState(raw, policyRaw, requirements = {
2772
2772
  : pr.mergeable?.toUpperCase() === 'CONFLICTING'
2773
2773
  ? 'conflicting'
2774
2774
  : 'unknown';
2775
- const reviewDecision = pr.reviewDecision?.toUpperCase() === 'APPROVED'
2775
+ const decision = (pr.reviewDecision ?? '').toUpperCase();
2776
+ const reviewDecision = decision === 'APPROVED'
2776
2777
  ? 'approved'
2777
- : pr.reviewDecision?.toUpperCase() === 'CHANGES_REQUESTED'
2778
+ : decision === 'CHANGES_REQUESTED'
2778
2779
  ? 'changes-requested'
2779
- : pr.reviewDecision?.toUpperCase() === 'REVIEW_REQUIRED'
2780
+ : decision === 'REVIEW_REQUIRED'
2780
2781
  ? 'review-required'
2781
- : 'unknown';
2782
+ : // GitHub leaves the decision empty when no review is required — trust that only once the
2783
+ // rules were read and agree, so an unreadable ruleset never turns into "not required".
2784
+ decision === '' && requirements.readable && requirements.reviewsRequired === false
2785
+ ? 'not-required'
2786
+ : 'unknown';
2782
2787
  const checks = (pr.statusCheckRollup ?? []).map((check) => ({
2783
2788
  name: check.name,
2784
2789
  state: mergeCheckState(check),
@@ -2925,6 +2930,69 @@ async function fetchMergeChecks(repoRoot, repoRef, number) {
2925
2930
  };
2926
2931
  }
2927
2932
  }
2933
+ /** GitHub's 404s for a rule that is simply not configured — anything else (403, 401, a bare
2934
+ * "Not Found", a network error) means the rule could not be read. */
2935
+ const PROTECTION_ABSENT = /Branch not protected|Required status checks not enabled|Required pull request reviews not enabled/i;
2936
+ function protectionAbsent(err) {
2937
+ const text = [err instanceof Error ? err.message : String(err), ghStderr(err) ?? '', err?.stdout]
2938
+ .filter((part) => typeof part === 'string')
2939
+ .join('\n');
2940
+ return /HTTP 404/.test(text) && PROTECTION_ABSENT.test(text);
2941
+ }
2942
+ const rulesetRulesSchema = z.array(z.object({ type: z.string(), parameters: z.record(z.string(), z.unknown()).nullish() }).passthrough());
2943
+ /**
2944
+ * The base branch's required checks and reviews, merged from classic branch protection and
2945
+ * repository rulesets — classic protection alone misses every ruleset-based requirement. Any read
2946
+ * that fails for a reason other than "not configured" leaves the whole answer unreadable.
2947
+ */
2948
+ async function fetchMergeRequirements(repoRoot, repoRef, base) {
2949
+ const repo = `repos/${repoRef.owner}/${repoRef.repo}`;
2950
+ const branch = encodeURIComponent(base);
2951
+ const classic = (path, parse, absent) => gh(repoRoot, ['api', `${repo}/branches/${branch}/protection/${path}`])
2952
+ .then(parse)
2953
+ .catch((err) => (protectionAbsent(err) ? absent : null));
2954
+ const [classicChecks, classicReviews, rules] = await Promise.all([
2955
+ classic('required_status_checks', (output) => {
2956
+ const body = z
2957
+ .object({ contexts: z.array(z.string()).nullish(), checks: z.array(z.object({ context: z.string() })).nullish() })
2958
+ .parse(JSON.parse(output));
2959
+ return [...(body.contexts ?? []), ...(body.checks ?? []).map((check) => check.context)];
2960
+ }, []),
2961
+ classic('required_pull_request_reviews', (output) => {
2962
+ const body = z
2963
+ .object({ required_approving_review_count: z.number().nullish(), require_code_owner_reviews: z.boolean().nullish() })
2964
+ .parse(JSON.parse(output));
2965
+ return (body.required_approving_review_count ?? 0) > 0 || body.require_code_owner_reviews === true;
2966
+ }, false),
2967
+ gh(repoRoot, ['api', `${repo}/rules/branches/${branch}?per_page=100`])
2968
+ .then((output) => rulesetRulesSchema.parse(JSON.parse(output)))
2969
+ .catch(() => null),
2970
+ ]);
2971
+ if (classicChecks === null || classicReviews === null || rules === null) {
2972
+ return { readable: false, requiredChecks: [] };
2973
+ }
2974
+ const requiredChecks = new Set(classicChecks);
2975
+ let reviewsRequired = classicReviews;
2976
+ for (const rule of rules) {
2977
+ if (rule.type === 'required_status_checks') {
2978
+ const parsed = z
2979
+ .object({ required_status_checks: z.array(z.object({ context: z.string() })) })
2980
+ .safeParse(rule.parameters);
2981
+ // A rule we cannot read is a requirement we cannot honour — never drop it silently.
2982
+ if (!parsed.success)
2983
+ return { readable: false, requiredChecks: [] };
2984
+ for (const check of parsed.data.required_status_checks)
2985
+ requiredChecks.add(check.context);
2986
+ }
2987
+ else if (rule.type === 'pull_request') {
2988
+ const params = rule.parameters ?? {};
2989
+ const count = typeof params.required_approving_review_count === 'number' ? params.required_approving_review_count : 1;
2990
+ if (count > 0 || params.require_code_owner_review === true)
2991
+ reviewsRequired = true;
2992
+ }
2993
+ }
2994
+ return { readable: true, requiredChecks: [...requiredChecks].sort(), reviewsRequired };
2995
+ }
2928
2996
  /** Test hook — the merge-state cache would otherwise leak state across cases in one process. */
2929
2997
  export function __clearMergeStateCacheForTests() {
2930
2998
  mergeStateCache.clear();
@@ -2966,21 +3034,14 @@ export async function fetchPrMergeState(repoRoot, repoRef, number, refresh = fal
2966
3034
  'number,title,url,state,isDraft,headRefName,baseRefName,headRefOid,mergeable,mergeStateStatus,reviewDecision',
2967
3035
  ]);
2968
3036
  const parsedPr = mergePrSchema.parse(JSON.parse(prOut));
2969
- const [policyOut, requiredChecks, checks] = await Promise.all([
3037
+ const [policyOut, requirements, checks] = await Promise.all([
2970
3038
  gh(repoRoot, ['api', `repos/${repoRef.owner}/${repoRef.repo}`]),
2971
- gh(repoRoot, [
2972
- 'api',
2973
- `repos/${repoRef.owner}/${repoRef.repo}/branches/${encodeURIComponent(parsedPr.baseRefName)}/protection/required_status_checks`,
2974
- '--jq',
2975
- '[.contexts[]?, .checks[]?.context] | unique',
2976
- ])
2977
- .then((output) => ({ readable: true, requiredChecks: z.array(z.string()).parse(JSON.parse(output)) }))
2978
- .catch(() => ({ readable: false, requiredChecks: [] })),
3039
+ fetchMergeRequirements(repoRoot, repoRef, parsedPr.baseRefName),
2979
3040
  fetchMergeChecks(repoRoot, repoRef, number),
2980
3041
  ]);
2981
3042
  const value = {
2982
3043
  available: true,
2983
- mergeState: normalizeMergeState({ ...parsedPr, statusCheckRollup: checks.rollup }, JSON.parse(policyOut), requiredChecks, { tier: checks.tier, ...(checks.reason ? { reason: checks.reason } : {}) }),
3044
+ mergeState: normalizeMergeState({ ...parsedPr, statusCheckRollup: checks.rollup }, JSON.parse(policyOut), requirements, { tier: checks.tier, ...(checks.reason ? { reason: checks.reason } : {}) }),
2984
3045
  };
2985
3046
  mergeStateCache.set(key, { at: Date.now(), value });
2986
3047
  return value;