agent-control-plane 0.1.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/LICENSE +21 -0
- package/README.md +589 -0
- package/SKILL.md +149 -0
- package/assets/workflow-catalog.json +57 -0
- package/bin/audit-issue-routing.sh +74 -0
- package/bin/issue-resource-class.sh +58 -0
- package/bin/label-follow-up-issues.sh +114 -0
- package/bin/pr-risk.sh +532 -0
- package/bin/sync-pr-labels.sh +112 -0
- package/hooks/heartbeat-hooks.sh +573 -0
- package/hooks/issue-reconcile-hooks.sh +217 -0
- package/hooks/pr-reconcile-hooks.sh +225 -0
- package/npm/bin/agent-control-plane.js +1984 -0
- package/npm/public-bin/agent-control-plane +3 -0
- package/package.json +61 -0
- package/tools/bin/agent-cleanup-worktree +247 -0
- package/tools/bin/agent-github-update-labels +66 -0
- package/tools/bin/agent-init-worktree +216 -0
- package/tools/bin/agent-project-archive-run +52 -0
- package/tools/bin/agent-project-capture-worker +46 -0
- package/tools/bin/agent-project-catch-up-merged-prs +137 -0
- package/tools/bin/agent-project-cleanup-session +244 -0
- package/tools/bin/agent-project-detached-launch +107 -0
- package/tools/bin/agent-project-heartbeat-loop +2347 -0
- package/tools/bin/agent-project-open-issue-worktree +89 -0
- package/tools/bin/agent-project-open-pr-worktree +80 -0
- package/tools/bin/agent-project-publish-issue-pr +349 -0
- package/tools/bin/agent-project-reconcile-issue-session +1128 -0
- package/tools/bin/agent-project-reconcile-pr-session +1005 -0
- package/tools/bin/agent-project-retry-state +147 -0
- package/tools/bin/agent-project-run-claude-session +657 -0
- package/tools/bin/agent-project-run-codex-resilient +718 -0
- package/tools/bin/agent-project-run-codex-session +316 -0
- package/tools/bin/agent-project-run-kilo-session +27 -0
- package/tools/bin/agent-project-run-openclaw-session +984 -0
- package/tools/bin/agent-project-run-opencode-session +27 -0
- package/tools/bin/agent-project-sync-anchor-repo +128 -0
- package/tools/bin/agent-project-worker-status +143 -0
- package/tools/bin/audit-agent-worktrees.sh +310 -0
- package/tools/bin/audit-issue-routing.sh +11 -0
- package/tools/bin/audit-retained-layout.sh +58 -0
- package/tools/bin/audit-retained-overlap.sh +135 -0
- package/tools/bin/audit-retained-worktrees.sh +228 -0
- package/tools/bin/branch-verification-guard.sh +351 -0
- package/tools/bin/capture-worker.sh +18 -0
- package/tools/bin/check-skill-contracts.sh +324 -0
- package/tools/bin/cleanup-worktree.sh +44 -0
- package/tools/bin/codex-quota +31 -0
- package/tools/bin/create-follow-up-issue.sh +114 -0
- package/tools/bin/dashboard-launchd-bootstrap.sh +38 -0
- package/tools/bin/flow-config-lib.sh +2127 -0
- package/tools/bin/flow-resident-worker-lib.sh +683 -0
- package/tools/bin/flow-runtime-doctor.sh +97 -0
- package/tools/bin/flow-shell-lib.sh +266 -0
- package/tools/bin/heartbeat-recovery-preflight.sh +106 -0
- package/tools/bin/heartbeat-safe-auto.sh +551 -0
- package/tools/bin/install-dashboard-launchd.sh +152 -0
- package/tools/bin/install-project-launchd.sh +219 -0
- package/tools/bin/issue-publish-scope-guard.sh +242 -0
- package/tools/bin/issue-requires-local-workspace-install.sh +31 -0
- package/tools/bin/issue-resource-class.sh +12 -0
- package/tools/bin/kick-scheduler.sh +75 -0
- package/tools/bin/label-follow-up-issues.sh +14 -0
- package/tools/bin/new-pr-worktree.sh +50 -0
- package/tools/bin/new-worktree.sh +49 -0
- package/tools/bin/pr-risk.sh +12 -0
- package/tools/bin/prepare-worktree.sh +140 -0
- package/tools/bin/profile-activate.sh +109 -0
- package/tools/bin/profile-adopt.sh +219 -0
- package/tools/bin/profile-smoke.sh +461 -0
- package/tools/bin/project-init.sh +189 -0
- package/tools/bin/project-launchd-bootstrap.sh +54 -0
- package/tools/bin/project-remove.sh +155 -0
- package/tools/bin/project-runtime-supervisor.sh +56 -0
- package/tools/bin/project-runtimectl.sh +586 -0
- package/tools/bin/provider-cooldown-state.sh +166 -0
- package/tools/bin/publish-issue-worker.sh +31 -0
- package/tools/bin/reconcile-issue-worker.sh +34 -0
- package/tools/bin/reconcile-pr-worker.sh +34 -0
- package/tools/bin/record-verification.sh +71 -0
- package/tools/bin/render-architecture-infographics.sh +110 -0
- package/tools/bin/render-dashboard-demo-media.sh +333 -0
- package/tools/bin/render-dashboard-snapshot.py +16 -0
- package/tools/bin/render-flow-config.sh +86 -0
- package/tools/bin/retry-state.sh +31 -0
- package/tools/bin/reuse-issue-worktree.sh +75 -0
- package/tools/bin/run-codex-bypass.sh +3 -0
- package/tools/bin/run-codex-safe.sh +3 -0
- package/tools/bin/run-codex-task.sh +231 -0
- package/tools/bin/scaffold-profile.sh +374 -0
- package/tools/bin/serve-dashboard.sh +5 -0
- package/tools/bin/split-retained-slice.sh +124 -0
- package/tools/bin/start-issue-worker.sh +796 -0
- package/tools/bin/start-pr-fix-worker.sh +458 -0
- package/tools/bin/start-pr-merge-repair-worker.sh +8 -0
- package/tools/bin/start-pr-review-worker.sh +227 -0
- package/tools/bin/start-resident-issue-loop.sh +908 -0
- package/tools/bin/sync-agent-repo.sh +52 -0
- package/tools/bin/sync-dependency-baseline.sh +247 -0
- package/tools/bin/sync-pr-labels.sh +12 -0
- package/tools/bin/sync-recurring-issue-checklist.sh +274 -0
- package/tools/bin/sync-shared-agent-home.sh +214 -0
- package/tools/bin/sync-vscode-workspace.sh +157 -0
- package/tools/bin/test-smoke.sh +63 -0
- package/tools/bin/uninstall-project-launchd.sh +55 -0
- package/tools/bin/update-github-labels.sh +14 -0
- package/tools/bin/worker-status.sh +19 -0
- package/tools/bin/workflow-catalog.sh +77 -0
- package/tools/dashboard/app.js +286 -0
- package/tools/dashboard/dashboard_snapshot.py +466 -0
- package/tools/dashboard/index.html +41 -0
- package/tools/dashboard/server.py +64 -0
- package/tools/dashboard/styles.css +351 -0
- package/tools/templates/issue-prompt-template.md +109 -0
- package/tools/templates/pr-fix-template.md +120 -0
- package/tools/templates/pr-merge-repair-template.md +91 -0
- package/tools/templates/pr-review-template.md +62 -0
- package/tools/templates/scheduled-issue-prompt-template.md +62 -0
- package/tools/tests/test-agent-control-plane-npm-cli.sh +279 -0
- package/tools/tests/test-agent-github-update-labels-falls-back-to-repository-id.sh +56 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-clears-stale-sandbox-artifacts.sh +89 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-does-not-retry-provider-quota.sh +82 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-retries-transient-failures.sh +90 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-times-out.sh +73 -0
- package/tools/tests/test-agent-project-claude-session-wrapper.sh +103 -0
- package/tools/tests/test-agent-project-cleanup-session-orphan-fallback.sh +90 -0
- package/tools/tests/test-agent-project-cleanup-session-skip-worktree-cleanup.sh +90 -0
- package/tools/tests/test-agent-project-codex-live-thread-persist.sh +76 -0
- package/tools/tests/test-agent-project-codex-recovery.sh +731 -0
- package/tools/tests/test-agent-project-codex-session-wrapper-clears-stale-sandbox-artifacts.sh +105 -0
- package/tools/tests/test-agent-project-codex-session-wrapper.sh +97 -0
- package/tools/tests/test-agent-project-open-pr-worktree-config-prefix.sh +81 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-clears-stale-sandbox-artifacts.sh +109 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-infers-blocked-result-contract.sh +89 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-literal-env-artifacts.sh +113 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-version-mismatch.sh +135 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-resident.sh +179 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-reuses-existing-agent-after-add-race.sh +119 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-terminates-rate-limit-hang.sh +91 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper.sh +117 -0
- package/tools/tests/test-agent-project-publish-issue-pr-prunes-stale-worktree-entry.sh +148 -0
- package/tools/tests/test-agent-project-publish-issue-pr-reads-archived-session.sh +146 -0
- package/tools/tests/test-agent-project-publish-issue-pr-recovers-final-head.sh +145 -0
- package/tools/tests/test-agent-project-publish-issue-pr-reuses-existing-worktree.sh +147 -0
- package/tools/tests/test-agent-project-reconcile-failure-reason.sh +456 -0
- package/tools/tests/test-agent-project-reconcile-issue-archived-session-fallback.sh +96 -0
- package/tools/tests/test-agent-project-reconcile-issue-before-blocked.sh +90 -0
- package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery-uses-recovered-worktree.sh +212 -0
- package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery.sh +207 -0
- package/tools/tests/test-agent-project-reconcile-issue-provider-quota-schedules-provider-cooldown.sh +101 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-backfills-lane-metadata-from-worker-key.sh +113 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-clears-stale-failed-summary.sh +117 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-initializes-shared-agent-home.sh +55 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-normalizes-runner-state.sh +125 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-records-invalid-contract-summary.sh +118 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-skips-duplicate-blocked-comment.sh +144 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-standardizes-no-commits-blocker.sh +145 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-synthesizes-blocked-comment.sh +139 -0
- package/tools/tests/test-agent-project-reconcile-pr-blocked-host-recovery.sh +242 -0
- package/tools/tests/test-agent-project-reconcile-pr-guard-blocked-no-commit.sh +142 -0
- package/tools/tests/test-agent-project-reconcile-pr-provider-quota-schedules-provider-cooldown.sh +106 -0
- package/tools/tests/test-agent-project-reconcile-pr-session-initializes-shared-agent-home.sh +66 -0
- package/tools/tests/test-agent-project-reconcile-pr-updated-branch-noop.sh +129 -0
- package/tools/tests/test-audit-agent-worktrees-active-launch-skips-git-inspection.sh +69 -0
- package/tools/tests/test-audit-agent-worktrees-broken-worktree.sh +43 -0
- package/tools/tests/test-audit-agent-worktrees-pending-launch-owner.sh +46 -0
- package/tools/tests/test-audit-agent-worktrees-unreconciled-owner.sh +79 -0
- package/tools/tests/test-audit-issue-routing-managed-branch-globs.sh +56 -0
- package/tools/tests/test-branch-verification-guard-generated-artifacts.sh +72 -0
- package/tools/tests/test-branch-verification-guard-targeted-coverage.sh +125 -0
- package/tools/tests/test-codex-quota-manager-failure-driven-rotation.sh +178 -0
- package/tools/tests/test-codex-quota-wrapper.sh +37 -0
- package/tools/tests/test-contribution-docs.sh +18 -0
- package/tools/tests/test-control-plane-dashboard-runtime-smoke.sh +343 -0
- package/tools/tests/test-create-follow-up-issue.sh +73 -0
- package/tools/tests/test-dashboard-launchd-bootstrap.sh +55 -0
- package/tools/tests/test-flow-export-execution-env-exports-repo-id.sh +30 -0
- package/tools/tests/test-flow-export-github-cli-auth-env-prefers-git-credential.sh +48 -0
- package/tools/tests/test-flow-github-api-repo-fallback-preserves-input.sh +85 -0
- package/tools/tests/test-flow-github-api-repo-prefers-explicit-repository-id.sh +60 -0
- package/tools/tests/test-flow-github-issue-list-falls-back-to-repository-id.sh +64 -0
- package/tools/tests/test-flow-github-pr-list-falls-back-to-repository-id.sh +77 -0
- package/tools/tests/test-flow-resident-can-reuse-does-not-leak-metadata.sh +52 -0
- package/tools/tests/test-flow-resident-reap-stale-controllers.sh +63 -0
- package/tools/tests/test-flow-resolve-codex-quota-tools.sh +104 -0
- package/tools/tests/test-flow-runtime-doctor-profile-selection.sh +27 -0
- package/tools/tests/test-heartbeat-codex-pr-linked-issue-exclusion.sh +79 -0
- package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-idle-controller.sh +115 -0
- package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-live-lane-controller.sh +117 -0
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-claude.sh +96 -0
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-codex.sh +96 -0
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop.sh +96 -0
- package/tools/tests/test-heartbeat-loop-auth-wait-does-not-consume-capacity.sh +170 -0
- package/tools/tests/test-heartbeat-loop-blocked-recovery-lane.sh +201 -0
- package/tools/tests/test-heartbeat-loop-blocked-recovery-vs-pr-reservation.sh +201 -0
- package/tools/tests/test-heartbeat-loop-idle-resident-controller-does-not-block-launches.sh +160 -0
- package/tools/tests/test-heartbeat-loop-pr-launch-dedup.sh +133 -0
- package/tools/tests/test-heartbeat-loop-provider-cooldown-suppresses-launches.sh +157 -0
- package/tools/tests/test-heartbeat-loop-reaps-stale-resident-controller.sh +181 -0
- package/tools/tests/test-heartbeat-loop-waiting-provider-resident-controller-does-not-block-launches.sh +160 -0
- package/tools/tests/test-heartbeat-ready-issues-blocked-recovery.sh +134 -0
- package/tools/tests/test-heartbeat-safe-auto-dynamic-concurrency.sh +162 -0
- package/tools/tests/test-heartbeat-safe-auto-no-tmux-sessions.sh +136 -0
- package/tools/tests/test-heartbeat-safe-auto-openclaw-skips-codex-quota.sh +139 -0
- package/tools/tests/test-heartbeat-safe-auto-quota-health-signal.sh +119 -0
- package/tools/tests/test-heartbeat-safe-auto-stale-shared-loop-pid-does-not-skip.sh +140 -0
- package/tools/tests/test-heartbeat-safe-auto-static-capacity-without-quota-cache.sh +142 -0
- package/tools/tests/test-heartbeat-safe-auto-zero-healthy-pools.sh +141 -0
- package/tools/tests/test-heartbeat-sync-issue-labels-empty-schedule.sh +65 -0
- package/tools/tests/test-heartbeat-sync-open-agent-prs-terminal-clears-running.sh +179 -0
- package/tools/tests/test-install-dashboard-launchd.sh +78 -0
- package/tools/tests/test-install-project-launchd-adds-tool-paths.sh +87 -0
- package/tools/tests/test-install-project-launchd.sh +110 -0
- package/tools/tests/test-issue-local-workspace-install-policy.sh +81 -0
- package/tools/tests/test-issue-publish-scope-guard-docs-signal.sh +70 -0
- package/tools/tests/test-issue-reconcile-hooks-success-clears-blocked.sh +36 -0
- package/tools/tests/test-kick-scheduler-requires-explicit-profile.sh +47 -0
- package/tools/tests/test-label-follow-up-issues-falls-back-to-repository-id.sh +132 -0
- package/tools/tests/test-manual-operator-entrypoints-require-explicit-profile.sh +64 -0
- package/tools/tests/test-package-funding-metadata.sh +21 -0
- package/tools/tests/test-package-public-metadata.sh +62 -0
- package/tools/tests/test-placeholder-worker-adapters.sh +38 -0
- package/tools/tests/test-pr-reconcile-hooks-refreshes-recurring-issue-checklist.sh +110 -0
- package/tools/tests/test-pr-risk-cohesive-mobile-locale-scope.sh +70 -0
- package/tools/tests/test-pr-risk-fix-label-semantics.sh +114 -0
- package/tools/tests/test-pr-risk-local-first-no-checks.sh +70 -0
- package/tools/tests/test-prepare-worktree-simple-repo-baseline.sh +67 -0
- package/tools/tests/test-profile-activate.sh +33 -0
- package/tools/tests/test-profile-adopt-allow-missing-repo.sh +68 -0
- package/tools/tests/test-profile-adopt-skip-workspace-sync-missing-file.sh +61 -0
- package/tools/tests/test-profile-adopt-syncs-anchor-and-workspace.sh +90 -0
- package/tools/tests/test-profile-smoke-collision.sh +44 -0
- package/tools/tests/test-profile-smoke-invalid-claude-config.sh +31 -0
- package/tools/tests/test-profile-smoke-invalid-provider-pool.sh +68 -0
- package/tools/tests/test-profile-smoke-repo-slug-mismatch.sh +36 -0
- package/tools/tests/test-profile-smoke.sh +45 -0
- package/tools/tests/test-project-init-force-and-skip-sync.sh +61 -0
- package/tools/tests/test-project-init-repo-slug-mismatch.sh +29 -0
- package/tools/tests/test-project-init.sh +66 -0
- package/tools/tests/test-project-launchd-bootstrap.sh +66 -0
- package/tools/tests/test-project-remove.sh +150 -0
- package/tools/tests/test-project-runtime-supervisor.sh +47 -0
- package/tools/tests/test-project-runtimectl-launchd.sh +115 -0
- package/tools/tests/test-project-runtimectl-missing-profile.sh +54 -0
- package/tools/tests/test-project-runtimectl-start-falls-back-to-bootstrap.sh +108 -0
- package/tools/tests/test-project-runtimectl-status-reports-supervisor-as-heartbeat-parent.sh +95 -0
- package/tools/tests/test-project-runtimectl-status-supervisor-running.sh +59 -0
- package/tools/tests/test-project-runtimectl-stop-cancels-pending-kick.sh +85 -0
- package/tools/tests/test-project-runtimectl-stop-clears-running-labels.sh +78 -0
- package/tools/tests/test-project-runtimectl.sh +212 -0
- package/tools/tests/test-provider-cooldown-state-prefers-runtime-worker-context.sh +39 -0
- package/tools/tests/test-provider-cooldown-state.sh +59 -0
- package/tools/tests/test-public-repo-docs.sh +159 -0
- package/tools/tests/test-reconcile-pr-worker-acp-config-routing.sh +75 -0
- package/tools/tests/test-render-dashboard-snapshot.sh +149 -0
- package/tools/tests/test-render-flow-config-demo-profile.sh +36 -0
- package/tools/tests/test-render-flow-config-provider-pool-fallback.sh +81 -0
- package/tools/tests/test-render-flow-config.sh +52 -0
- package/tools/tests/test-run-codex-task-claude-routing.sh +125 -0
- package/tools/tests/test-run-codex-task-codex-resident-routing.sh +108 -0
- package/tools/tests/test-run-codex-task-kilo-routing.sh +98 -0
- package/tools/tests/test-run-codex-task-openclaw-resident-routing.sh +117 -0
- package/tools/tests/test-run-codex-task-openclaw-routing.sh +113 -0
- package/tools/tests/test-run-codex-task-opencode-routing.sh +98 -0
- package/tools/tests/test-run-codex-task-provider-pool-fallback-routing.sh +146 -0
- package/tools/tests/test-scaffold-profile.sh +108 -0
- package/tools/tests/test-serve-dashboard.sh +93 -0
- package/tools/tests/test-start-issue-worker-blocked-context.sh +129 -0
- package/tools/tests/test-start-issue-worker-blocks-complete-recurring-checklist.sh +189 -0
- package/tools/tests/test-start-issue-worker-local-install-routing.sh +157 -0
- package/tools/tests/test-start-issue-worker-profile-template-routing.sh +149 -0
- package/tools/tests/test-start-issue-worker-recurring-resident-reuse-codex.sh +212 -0
- package/tools/tests/test-start-issue-worker-recurring-resident-reuse.sh +219 -0
- package/tools/tests/test-start-issue-worker-renders-verification-snippet.sh +155 -0
- package/tools/tests/test-start-issue-worker-resident-reuse-falls-back-to-new-worktree.sh +199 -0
- package/tools/tests/test-start-pr-fix-worker-host-blocker-context.sh +275 -0
- package/tools/tests/test-start-resident-issue-loop-adopts-next-recurring-issue.sh +185 -0
- package/tools/tests/test-start-resident-issue-loop-clears-pending-while-waiting-due.sh +152 -0
- package/tools/tests/test-start-resident-issue-loop-consumes-queued-lease.sh +186 -0
- package/tools/tests/test-start-resident-issue-loop-fails-over-provider-pool.sh +212 -0
- package/tools/tests/test-start-resident-issue-loop-immediate-cycles.sh +148 -0
- package/tools/tests/test-start-resident-issue-loop-waits-for-provider.sh +194 -0
- package/tools/tests/test-start-resident-issue-loop-waits-for-terminal-reconcile-status.sh +198 -0
- package/tools/tests/test-start-resident-issue-loop-yields-to-live-lane-controller.sh +145 -0
- package/tools/tests/test-sync-pr-labels-fix-lane-uses-repair-queued.sh +67 -0
- package/tools/tests/test-sync-recurring-issue-checklist-backfills-workflow-complete-blocker.sh +70 -0
- package/tools/tests/test-sync-recurring-issue-checklist.sh +95 -0
- package/tools/tests/test-sync-shared-agent-home-local-source-root.sh +66 -0
- package/tools/tests/test-sync-shared-agent-home-preserves-unrelated-workflow-catalog-skill.sh +47 -0
- package/tools/tests/test-test-smoke.sh +86 -0
- package/tools/tests/test-uninstall-project-launchd.sh +37 -0
- package/tools/tests/test-update-github-labels-prefers-sibling-helper.sh +49 -0
- package/tools/tests/test-workflow-catalog.sh +43 -0
- package/tools/vendor/codex-quota/LICENSE +21 -0
- package/tools/vendor/codex-quota/README.md +459 -0
- package/tools/vendor/codex-quota/codex-quota.js +261 -0
- package/tools/vendor/codex-quota/lib/claude-accounts.js +226 -0
- package/tools/vendor/codex-quota/lib/claude-oauth.js +174 -0
- package/tools/vendor/codex-quota/lib/claude-tokens.js +471 -0
- package/tools/vendor/codex-quota/lib/claude-usage.js +929 -0
- package/tools/vendor/codex-quota/lib/codex-accounts.js +205 -0
- package/tools/vendor/codex-quota/lib/codex-tokens.js +326 -0
- package/tools/vendor/codex-quota/lib/codex-usage.js +32 -0
- package/tools/vendor/codex-quota/lib/color.js +72 -0
- package/tools/vendor/codex-quota/lib/constants.js +57 -0
- package/tools/vendor/codex-quota/lib/container.js +143 -0
- package/tools/vendor/codex-quota/lib/display.js +1111 -0
- package/tools/vendor/codex-quota/lib/fs.js +63 -0
- package/tools/vendor/codex-quota/lib/handlers.js +2060 -0
- package/tools/vendor/codex-quota/lib/jwt.js +33 -0
- package/tools/vendor/codex-quota/lib/oauth.js +486 -0
- package/tools/vendor/codex-quota/lib/paths.js +34 -0
- package/tools/vendor/codex-quota/lib/prompts.js +44 -0
- package/tools/vendor/codex-quota/lib/sync.js +1438 -0
- package/tools/vendor/codex-quota/lib/token-match.js +96 -0
- package/tools/vendor/codex-quota-manager/scripts/auto-switch.sh +500 -0
- package/tools/vendor/codex-quota-manager/scripts/batch-add.sh +123 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
HOOK_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
# shellcheck source=/dev/null
|
|
6
|
+
source "${HOOK_SCRIPT_DIR}/../tools/bin/flow-config-lib.sh"
|
|
7
|
+
|
|
8
|
+
FLOW_SKILL_DIR="$(cd "${HOOK_SCRIPT_DIR}/.." && pwd)"
|
|
9
|
+
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
10
|
+
ADAPTER_BIN_DIR="${FLOW_SKILL_DIR}/bin"
|
|
11
|
+
FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
|
|
12
|
+
REPO_SLUG="$(flow_resolve_repo_slug "${CONFIG_YAML}")"
|
|
13
|
+
AGENT_ROOT="$(flow_resolve_agent_root "${CONFIG_YAML}")"
|
|
14
|
+
STATE_ROOT="$(flow_resolve_state_root "${CONFIG_YAML}")"
|
|
15
|
+
RUNS_ROOT="$(flow_resolve_runs_root "${CONFIG_YAML}")"
|
|
16
|
+
BLOCKED_RECOVERY_STATE_DIR="${STATE_ROOT}/blocked-recovery-issues"
|
|
17
|
+
|
|
18
|
+
issue_clear_blocked_recovery_state() {
|
|
19
|
+
rm -f "${BLOCKED_RECOVERY_STATE_DIR}/${ISSUE_ID}.env" 2>/dev/null || true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
issue_has_schedule_cadence() {
|
|
23
|
+
local issue_json issue_body
|
|
24
|
+
issue_json="$(flow_github_issue_view_json "${REPO_SLUG}" "${ISSUE_ID}" 2>/dev/null || true)"
|
|
25
|
+
issue_body="$(jq -r '.body // ""' <<<"${issue_json:-"{}"}")"
|
|
26
|
+
ISSUE_BODY="$issue_body" node <<'EOF' >/dev/null
|
|
27
|
+
const body = process.env.ISSUE_BODY || '';
|
|
28
|
+
const match = body.match(/^\s*(?:Agent schedule|Schedule|Cadence)\s*:\s*(?:every\s+)?(\d+)\s*([mhd])\s*$/im);
|
|
29
|
+
process.exit(match ? 0 : 1);
|
|
30
|
+
EOF
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
issue_scheduled_status_kind() {
|
|
34
|
+
local issue_json issue_title issue_body
|
|
35
|
+
issue_json="$(flow_github_issue_view_json "${REPO_SLUG}" "${ISSUE_ID}" 2>/dev/null || true)"
|
|
36
|
+
issue_title="$(jq -r '.title // ""' <<<"${issue_json:-"{}"}")"
|
|
37
|
+
issue_body="$(jq -r '.body // ""' <<<"${issue_json:-"{}"}")"
|
|
38
|
+
ISSUE_TITLE="$issue_title" ISSUE_BODY="$issue_body" node <<'EOF'
|
|
39
|
+
const title = process.env.ISSUE_TITLE || '';
|
|
40
|
+
const body = process.env.ISSUE_BODY || '';
|
|
41
|
+
const haystack = `${title}\n${body}`.toLowerCase();
|
|
42
|
+
if (/\be2e\b|\bsmoke\b|playwright|detox|maestro|automation test|smoke test/.test(haystack)) {
|
|
43
|
+
process.stdout.write('smoke\n');
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
if (/\btypecheck\b|\blint\b|\bunit test\b|\bunit-test\b|\bjest\b|\bvitest\b|\btest suite\b|\bbuild\b|\bci\b/.test(haystack)) {
|
|
47
|
+
process.stdout.write('checks\n');
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
if (/\bhealth\b|\/health\b|prod health|system health/.test(haystack)) {
|
|
51
|
+
process.stdout.write('health\n');
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
process.stdout.write('\n');
|
|
55
|
+
EOF
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
issue_ensure_status_label_exists() {
|
|
59
|
+
local label_name="${1:?label required}"
|
|
60
|
+
local label_description="${2:-}"
|
|
61
|
+
local label_color="${3:-1D76DB}"
|
|
62
|
+
flow_github_label_create "$REPO_SLUG" "$label_name" "$label_description" "$label_color" >/dev/null 2>&1 || true
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
issue_update_scheduled_status() {
|
|
66
|
+
local status_kind="${1:?status required}"
|
|
67
|
+
local scheduled_kind ok_label alert_label
|
|
68
|
+
|
|
69
|
+
if ! issue_has_schedule_cadence; then
|
|
70
|
+
return 0
|
|
71
|
+
fi
|
|
72
|
+
scheduled_kind="$(issue_scheduled_status_kind)"
|
|
73
|
+
if [[ -z "$scheduled_kind" ]]; then
|
|
74
|
+
return 0
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
case "$scheduled_kind" in
|
|
78
|
+
health)
|
|
79
|
+
ok_label="health-ok"
|
|
80
|
+
alert_label="health-not-ok"
|
|
81
|
+
issue_ensure_status_label_exists "$ok_label" "Latest scheduled health check passed" "0E8A16"
|
|
82
|
+
issue_ensure_status_label_exists "$alert_label" "Latest scheduled health check reported an alert" "B60205"
|
|
83
|
+
;;
|
|
84
|
+
checks)
|
|
85
|
+
ok_label="checks-ok"
|
|
86
|
+
alert_label="checks-not-ok"
|
|
87
|
+
issue_ensure_status_label_exists "$ok_label" "Latest scheduled verification checks passed" "0E8A16"
|
|
88
|
+
issue_ensure_status_label_exists "$alert_label" "Latest scheduled verification checks reported an alert" "B60205"
|
|
89
|
+
;;
|
|
90
|
+
smoke)
|
|
91
|
+
ok_label="smoke-ok"
|
|
92
|
+
alert_label="smoke-not-ok"
|
|
93
|
+
issue_ensure_status_label_exists "$ok_label" "Latest scheduled smoke or E2E check passed" "0E8A16"
|
|
94
|
+
issue_ensure_status_label_exists "$alert_label" "Latest scheduled smoke or E2E check reported an alert" "B60205"
|
|
95
|
+
;;
|
|
96
|
+
*)
|
|
97
|
+
return 0
|
|
98
|
+
;;
|
|
99
|
+
esac
|
|
100
|
+
|
|
101
|
+
case "$status_kind" in
|
|
102
|
+
ok)
|
|
103
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" \
|
|
104
|
+
--repo-slug "${REPO_SLUG}" \
|
|
105
|
+
--number "$ISSUE_ID" \
|
|
106
|
+
--remove health-ok \
|
|
107
|
+
--remove health-not-ok \
|
|
108
|
+
--remove checks-ok \
|
|
109
|
+
--remove checks-not-ok \
|
|
110
|
+
--remove smoke-ok \
|
|
111
|
+
--remove smoke-not-ok \
|
|
112
|
+
--add "$ok_label" >/dev/null || true
|
|
113
|
+
;;
|
|
114
|
+
alert)
|
|
115
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" \
|
|
116
|
+
--repo-slug "${REPO_SLUG}" \
|
|
117
|
+
--number "$ISSUE_ID" \
|
|
118
|
+
--remove health-ok \
|
|
119
|
+
--remove health-not-ok \
|
|
120
|
+
--remove checks-ok \
|
|
121
|
+
--remove checks-not-ok \
|
|
122
|
+
--remove smoke-ok \
|
|
123
|
+
--remove smoke-not-ok \
|
|
124
|
+
--add "$alert_label" >/dev/null || true
|
|
125
|
+
;;
|
|
126
|
+
esac
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
issue_before_success() {
|
|
130
|
+
if issue_has_schedule_cadence; then
|
|
131
|
+
return 0
|
|
132
|
+
fi
|
|
133
|
+
ACP_AGENT_ROOT="${AGENT_ROOT}" ACP_RUNS_ROOT="${RUNS_ROOT}" F_LOSNING_RUNS_ROOT="${RUNS_ROOT}" \
|
|
134
|
+
"${ADAPTER_BIN_DIR}/label-follow-up-issues.sh" "$SESSION" >/dev/null || true
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
issue_before_blocked() {
|
|
138
|
+
if issue_has_schedule_cadence; then
|
|
139
|
+
return 0
|
|
140
|
+
fi
|
|
141
|
+
ACP_AGENT_ROOT="${AGENT_ROOT}" ACP_RUNS_ROOT="${RUNS_ROOT}" F_LOSNING_RUNS_ROOT="${RUNS_ROOT}" \
|
|
142
|
+
"${ADAPTER_BIN_DIR}/label-follow-up-issues.sh" "$SESSION" >/dev/null || true
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
issue_schedule_retry() {
|
|
146
|
+
local reason="${1:?reason required}"
|
|
147
|
+
if issue_has_schedule_cadence; then
|
|
148
|
+
return 0
|
|
149
|
+
fi
|
|
150
|
+
"${FLOW_TOOLS_DIR}/retry-state.sh" issue "$ISSUE_ID" schedule "$reason" >/dev/null || true
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
issue_mark_ready() {
|
|
154
|
+
issue_clear_blocked_recovery_state
|
|
155
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" --repo-slug "${REPO_SLUG}" --number "$ISSUE_ID" --remove agent-running --remove agent-blocked >/dev/null || true
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
issue_clear_retry() {
|
|
159
|
+
issue_clear_blocked_recovery_state
|
|
160
|
+
"${FLOW_TOOLS_DIR}/retry-state.sh" issue "$ISSUE_ID" clear >/dev/null || true
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
issue_publish_extra_args() {
|
|
164
|
+
printf '%s\n' --keep-open-label agent-keep-open
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
issue_remove_running() {
|
|
168
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" --repo-slug "${REPO_SLUG}" --number "$ISSUE_ID" --remove agent-ready --remove agent-running --remove agent-blocked >/dev/null || true
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
issue_mark_blocked() {
|
|
172
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" \
|
|
173
|
+
--repo-slug "${REPO_SLUG}" \
|
|
174
|
+
--number "$ISSUE_ID" \
|
|
175
|
+
--remove agent-running \
|
|
176
|
+
--add agent-blocked >/dev/null || true
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
issue_should_close_as_superseded() {
|
|
180
|
+
local comment_file="${run_dir}/issue-comment.md"
|
|
181
|
+
[[ -s "$comment_file" ]] || return 1
|
|
182
|
+
head -n 1 "$comment_file" | grep -q '^Superseded by focused follow-up issues:'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
issue_close_as_superseded() {
|
|
186
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" --repo-slug "${REPO_SLUG}" --number "$ISSUE_ID" --remove agent-running --remove agent-blocked >/dev/null || true
|
|
187
|
+
flow_github_issue_close "$REPO_SLUG" "$ISSUE_ID" >/dev/null 2>&1 || true
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
issue_after_pr_created() {
|
|
191
|
+
local pr_number="${1:?pr number required}"
|
|
192
|
+
local risk_json
|
|
193
|
+
risk_json="$("${ADAPTER_BIN_DIR}/pr-risk.sh" "$pr_number")"
|
|
194
|
+
if [[ "$(jq -r '.eligibleForAutoMerge' <<<"$risk_json")" == "true" ]]; then
|
|
195
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" --repo-slug "${REPO_SLUG}" --number "$pr_number" --add agent-automerge >/dev/null || true
|
|
196
|
+
fi
|
|
197
|
+
"${FLOW_TOOLS_DIR}/kick-scheduler.sh" 5 >/dev/null || true
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
issue_after_reconciled() {
|
|
201
|
+
local status="${1:-}"
|
|
202
|
+
local outcome="${2:-}"
|
|
203
|
+
local action="${3:-}"
|
|
204
|
+
|
|
205
|
+
if [[ "$status" == "SUCCEEDED" && "$outcome" == "reported" ]]; then
|
|
206
|
+
case "$action" in
|
|
207
|
+
host-comment-scheduled-report)
|
|
208
|
+
issue_update_scheduled_status ok
|
|
209
|
+
;;
|
|
210
|
+
host-comment-scheduled-alert)
|
|
211
|
+
issue_update_scheduled_status alert
|
|
212
|
+
;;
|
|
213
|
+
esac
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
"${FLOW_TOOLS_DIR}/kick-scheduler.sh" 2 >/dev/null || true
|
|
217
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
HOOK_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
# shellcheck source=/dev/null
|
|
6
|
+
source "${HOOK_SCRIPT_DIR}/../tools/bin/flow-config-lib.sh"
|
|
7
|
+
|
|
8
|
+
FLOW_SKILL_DIR="$(cd "${HOOK_SCRIPT_DIR}/.." && pwd)"
|
|
9
|
+
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
10
|
+
ADAPTER_BIN_DIR="${FLOW_SKILL_DIR}/bin"
|
|
11
|
+
FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
|
|
12
|
+
RUNS_ROOT="$(flow_resolve_runs_root "${CONFIG_YAML}")"
|
|
13
|
+
: "${RUNS_ROOT:?RUNS_ROOT is required}"
|
|
14
|
+
AGENT_ROOT="$(flow_resolve_agent_root "${CONFIG_YAML}")"
|
|
15
|
+
STATE_ROOT="$(flow_resolve_state_root "${CONFIG_YAML}")"
|
|
16
|
+
REPO_SLUG="$(flow_resolve_repo_slug "${CONFIG_YAML}")"
|
|
17
|
+
AGENT_REPO_ROOT="$(flow_resolve_agent_repo_root "${CONFIG_YAML}")"
|
|
18
|
+
ISSUE_SESSION_PREFIX="$(flow_resolve_issue_session_prefix "${CONFIG_YAML}")"
|
|
19
|
+
PR_WORKTREE_BRANCH_PREFIX="$(flow_resolve_pr_worktree_branch_prefix "${CONFIG_YAML}")"
|
|
20
|
+
PR_LANE_OVERRIDE_DIR="${STATE_ROOT}/pr-lane-overrides"
|
|
21
|
+
|
|
22
|
+
pr_best_effort_update_labels() {
|
|
23
|
+
bash "${FLOW_TOOLS_DIR}/agent-github-update-labels" "$@" >/dev/null 2>&1 || true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pr_best_effort_sync_pr_labels() {
|
|
27
|
+
"${ADAPTER_BIN_DIR}/sync-pr-labels.sh" "$1" >/dev/null 2>&1 || true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pr_set_lane_override() {
|
|
31
|
+
local pr_number="${1:?pr number required}"
|
|
32
|
+
local lane="${2:?lane required}"
|
|
33
|
+
mkdir -p "${PR_LANE_OVERRIDE_DIR}"
|
|
34
|
+
cat >"${PR_LANE_OVERRIDE_DIR}/${pr_number}.env" <<EOF
|
|
35
|
+
PR_LANE_OVERRIDE=${lane}
|
|
36
|
+
UPDATED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
37
|
+
EOF
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pr_clear_lane_override() {
|
|
41
|
+
local pr_number="${1:?pr number required}"
|
|
42
|
+
rm -f "${PR_LANE_OVERRIDE_DIR}/${pr_number}.env"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
pr_schedule_retry() {
|
|
46
|
+
local reason="${1:?reason required}"
|
|
47
|
+
"${FLOW_TOOLS_DIR}/retry-state.sh" pr "$PR_NUMBER" schedule "$reason" >/dev/null || true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pr_clear_retry() {
|
|
51
|
+
"${FLOW_TOOLS_DIR}/retry-state.sh" pr "$PR_NUMBER" clear >/dev/null || true
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pr_linked_issue_should_close() {
|
|
55
|
+
local issue_id="${1:?issue id required}"
|
|
56
|
+
local issue_json
|
|
57
|
+
issue_json="$(flow_github_issue_view_json "${REPO_SLUG}" "${issue_id}" 2>/dev/null || true)"
|
|
58
|
+
if [[ -n "$issue_json" ]] && jq -e 'any(.labels[]?; .name == "agent-keep-open")' >/dev/null <<<"$issue_json"; then
|
|
59
|
+
printf 'no\n'
|
|
60
|
+
else
|
|
61
|
+
printf 'yes\n'
|
|
62
|
+
fi
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pr_cleanup_linked_issue_session() {
|
|
66
|
+
local issue_id="${1:-}"
|
|
67
|
+
[[ -n "$issue_id" ]] || return 0
|
|
68
|
+
|
|
69
|
+
local should_close
|
|
70
|
+
should_close="$(pr_linked_issue_should_close "$issue_id")"
|
|
71
|
+
update_args=(--remove agent-ready --remove agent-running --remove agent-blocked --remove agent-e2e-heavy --remove agent-automerge --remove agent-exclusive)
|
|
72
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$issue_id" "${update_args[@]}"
|
|
73
|
+
|
|
74
|
+
local issue_session="${ISSUE_SESSION_PREFIX}${issue_id}"
|
|
75
|
+
local issue_meta="${RUNS_ROOT}/${issue_session}/run.env"
|
|
76
|
+
if [[ -f "$issue_meta" ]]; then
|
|
77
|
+
local issue_worktree
|
|
78
|
+
issue_worktree="$(awk -F= '/^WORKTREE=/{print $2}' "$issue_meta" | head -n 1)"
|
|
79
|
+
"${FLOW_TOOLS_DIR}/cleanup-worktree.sh" "${issue_worktree:-}" "$issue_session" >/dev/null || true
|
|
80
|
+
fi
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
pr_cleanup_merged_residue() {
|
|
84
|
+
local pr_number="${1:?pr number required}"
|
|
85
|
+
local agent_repo_root="${AGENT_REPO_ROOT}"
|
|
86
|
+
local cleanup_tool="${FLOW_TOOLS_DIR}/agent-cleanup-worktree"
|
|
87
|
+
local temp_branch=""
|
|
88
|
+
local head_ref=""
|
|
89
|
+
|
|
90
|
+
if [[ ! -d "$agent_repo_root" ]]; then
|
|
91
|
+
return 0
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
git -C "$agent_repo_root" fetch --prune origin >/dev/null 2>&1 || true
|
|
95
|
+
|
|
96
|
+
while IFS= read -r temp_branch; do
|
|
97
|
+
[[ -n "$temp_branch" ]] || continue
|
|
98
|
+
(
|
|
99
|
+
cd "$agent_repo_root"
|
|
100
|
+
"$cleanup_tool" --branch "$temp_branch" --remote "" --allow-unmerged >/dev/null
|
|
101
|
+
) || true
|
|
102
|
+
done < <(git -C "$agent_repo_root" for-each-ref --format='%(refname:short)' "refs/heads/${PR_WORKTREE_BRANCH_PREFIX}-${pr_number}-*")
|
|
103
|
+
|
|
104
|
+
head_ref="$(flow_github_pr_view_json "${REPO_SLUG}" "${pr_number}" 2>/dev/null | jq -r '.headRefName // empty' 2>/dev/null || true)"
|
|
105
|
+
if [[ -n "$head_ref" ]]; then
|
|
106
|
+
git -C "$agent_repo_root" branch -r -d "origin/${head_ref}" >/dev/null 2>&1 || true
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
git -C "$agent_repo_root" fetch --prune origin >/dev/null 2>&1 || true
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
pr_refresh_linked_issue_checklist() {
|
|
113
|
+
local pr_number="${1:?pr number required}"
|
|
114
|
+
local risk_json=""
|
|
115
|
+
local linked_issue_id=""
|
|
116
|
+
|
|
117
|
+
risk_json="$("${ADAPTER_BIN_DIR}/pr-risk.sh" "$pr_number" 2>/dev/null || true)"
|
|
118
|
+
[[ -n "${risk_json}" ]] || return 0
|
|
119
|
+
|
|
120
|
+
linked_issue_id="$(jq -r '.linkedIssueId // empty' <<<"${risk_json}")"
|
|
121
|
+
[[ -n "${linked_issue_id}" ]] || return 0
|
|
122
|
+
[[ "$(pr_linked_issue_should_close "${linked_issue_id}")" == "no" ]] || return 0
|
|
123
|
+
|
|
124
|
+
bash "${FLOW_TOOLS_DIR}/sync-recurring-issue-checklist.sh" \
|
|
125
|
+
--repo-slug "${REPO_SLUG}" \
|
|
126
|
+
--issue-id "${linked_issue_id}" >/dev/null 2>&1 || true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
pr_after_merged() {
|
|
130
|
+
local pr_number="${1:?pr number required}"
|
|
131
|
+
pr_clear_lane_override "$pr_number"
|
|
132
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-automerge --remove agent-repair-queued --remove agent-fix-needed --remove agent-manual-fix-override --remove agent-ci-refresh --remove agent-ci-bypassed --remove agent-double-check-1/2 --remove agent-double-check-2/2 --remove agent-human-review --remove agent-human-approved --remove agent-blocked --remove agent-handoff --remove agent-exclusive
|
|
133
|
+
pr_refresh_linked_issue_checklist "$pr_number"
|
|
134
|
+
"${FLOW_TOOLS_DIR}/kick-scheduler.sh" 5 >/dev/null || true
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
pr_after_closed() {
|
|
138
|
+
local pr_number="${1:?pr number required}"
|
|
139
|
+
pr_clear_lane_override "$pr_number"
|
|
140
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-automerge --remove agent-repair-queued --remove agent-fix-needed --remove agent-manual-fix-override --remove agent-ci-refresh --remove agent-ci-bypassed --remove agent-double-check-1/2 --remove agent-double-check-2/2 --remove agent-human-review --remove agent-human-approved --remove agent-blocked --remove agent-handoff --remove agent-exclusive
|
|
141
|
+
"${FLOW_TOOLS_DIR}/kick-scheduler.sh" 5 >/dev/null || true
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
pr_automerge_allowed() {
|
|
145
|
+
local pr_number="${1:?pr number required}"
|
|
146
|
+
local risk_json
|
|
147
|
+
risk_json="$("${ADAPTER_BIN_DIR}/pr-risk.sh" "$pr_number")"
|
|
148
|
+
local lane
|
|
149
|
+
lane="$(jq -r '.agentLane' <<<"$risk_json")"
|
|
150
|
+
if [[ "$lane" == "automerge" || "$lane" == "double-check-2" || "$(jq -r '.eligibleForAutoMerge' <<<"$risk_json")" == "true" ]]; then
|
|
151
|
+
printf 'yes\n'
|
|
152
|
+
else
|
|
153
|
+
printf 'no\n'
|
|
154
|
+
fi
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
pr_review_pass_action() {
|
|
158
|
+
local pr_number="${1:?pr number required}"
|
|
159
|
+
local risk_json lane
|
|
160
|
+
risk_json="$("${ADAPTER_BIN_DIR}/pr-risk.sh" "$pr_number")"
|
|
161
|
+
lane="$(jq -r '.agentLane' <<<"$risk_json")"
|
|
162
|
+
|
|
163
|
+
case "$lane" in
|
|
164
|
+
double-check-1)
|
|
165
|
+
printf 'advance-double-check-2\n'
|
|
166
|
+
;;
|
|
167
|
+
double-check-2|automerge)
|
|
168
|
+
printf 'merge\n'
|
|
169
|
+
;;
|
|
170
|
+
human-review)
|
|
171
|
+
printf 'wait-human\n'
|
|
172
|
+
;;
|
|
173
|
+
*)
|
|
174
|
+
printf 'merge\n'
|
|
175
|
+
;;
|
|
176
|
+
esac
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
pr_after_double_check_advanced() {
|
|
180
|
+
local pr_number="${1:?pr number required}"
|
|
181
|
+
local next_stage="${2:?next stage required}"
|
|
182
|
+
local next_label=""
|
|
183
|
+
|
|
184
|
+
case "$next_stage" in
|
|
185
|
+
2) next_label="agent-double-check-2/2" ;;
|
|
186
|
+
*) echo "unsupported double-check stage: $next_stage" >&2; return 1 ;;
|
|
187
|
+
esac
|
|
188
|
+
|
|
189
|
+
pr_set_lane_override "$pr_number" "double-check-${next_stage}"
|
|
190
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-automerge --remove agent-repair-queued --remove agent-fix-needed --remove agent-manual-fix-override --remove agent-ci-refresh --remove agent-human-review --remove agent-human-approved --remove agent-double-check-1/2 --remove agent-double-check-2/2 --add "$next_label"
|
|
191
|
+
pr_best_effort_sync_pr_labels "$pr_number"
|
|
192
|
+
"${FLOW_TOOLS_DIR}/kick-scheduler.sh" 5 >/dev/null || true
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
pr_after_updated_branch() {
|
|
196
|
+
local pr_number="${1:?pr number required}"
|
|
197
|
+
pr_clear_lane_override "$pr_number"
|
|
198
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-blocked --remove agent-repair-queued --remove agent-fix-needed --remove agent-manual-fix-override --remove agent-ci-refresh --remove agent-double-check-1/2 --remove agent-double-check-2/2 --remove agent-human-approved
|
|
199
|
+
pr_best_effort_sync_pr_labels "$pr_number"
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
pr_after_blocked() {
|
|
203
|
+
local pr_number="${1:?pr number required}"
|
|
204
|
+
pr_clear_lane_override "$pr_number"
|
|
205
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-blocked --remove agent-automerge --remove agent-ci-refresh --remove agent-ci-bypassed --remove agent-double-check-1/2 --remove agent-double-check-2/2 --remove agent-human-review --remove agent-human-approved --remove agent-fix-needed --remove agent-manual-fix-override --add agent-repair-queued
|
|
206
|
+
pr_best_effort_sync_pr_labels "$pr_number"
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
pr_after_succeeded() {
|
|
210
|
+
local pr_number="${1:?pr number required}"
|
|
211
|
+
pr_clear_lane_override "$pr_number"
|
|
212
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-repair-queued --remove agent-fix-needed --remove agent-manual-fix-override --remove agent-ci-refresh --remove agent-double-check-1/2 --remove agent-double-check-2/2
|
|
213
|
+
pr_best_effort_sync_pr_labels "$pr_number"
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
pr_after_failed() {
|
|
217
|
+
local pr_number="${1:?pr number required}"
|
|
218
|
+
pr_clear_lane_override "$pr_number"
|
|
219
|
+
pr_best_effort_update_labels --repo-slug "${REPO_SLUG}" --number "$pr_number" --remove agent-running --remove agent-blocked --remove agent-repair-queued --remove agent-fix-needed --remove agent-manual-fix-override --remove agent-ci-refresh --remove agent-double-check-1/2 --remove agent-double-check-2/2
|
|
220
|
+
pr_best_effort_sync_pr_labels "$pr_number"
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
pr_after_reconciled() {
|
|
224
|
+
"${FLOW_TOOLS_DIR}/kick-scheduler.sh" 2 >/dev/null || true
|
|
225
|
+
}
|