micro--go-micro
1c8d8f0ff6
`micro loop init` writes an autonomous improvement loop into any repository —
the same planner/builder/triage loop that maintains go-micro, generalized:
- planner (loop-planner.yml): keeps a ranked queue in .github/loop/PRIORITIES.md
- builder (loop-builder.yml): builds the top open item as a single-concern PR,
auto-merged on green CI
- triage (loop-triage.yml): turns CI failures into scoped fix issues
plus .github/loop/NORTH_STAR.md (direction) and PRIORITIES.md (queue).
The agent adapter is mention-based, not hardcoded to Codex: `--agent @codex`
(or any @mention agent that responds on an issue and can run gh), `--token-secret`,
`--branch`, `--ci-workflow`, and cron flags are the whole config-vs-core boundary.
Templates use << >> delimiters so GitHub Actions' own ${{ }} expressions pass
through untouched. `micro loop verify` checks the wiring and flags the two things
the CLI can't: the token secret and branch protection (the green-CI gate).
Built inside go-micro with the config/core split already drawn, so the workflows
can later be extracted to a standalone reusable-workflows repo without a rewrite.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL
47 行
2.7 KiB
Cheetah
47 行
2.7 KiB
Cheetah
name: "Loop: Builder"
|
|
|
|
# Generated by `micro loop init`. The GENERATOR of the loop: each run it opens a
|
|
# fresh tracking issue and dispatches the agent to build the top open item from
|
|
# .github/loop/PRIORITIES.md as a single-concern PR, then enables native
|
|
# auto-merge so the PR lands once the required CI checks pass. Branch protection
|
|
# (required checks, 0 approvals) is the gate — there is no merge sweep.
|
|
#
|
|
# A FRESH issue per run is deliberate: agents derive the PR branch name from the
|
|
# triggering issue, so reusing one tracker collapses every run onto one branch
|
|
# and only the first PR opens. Gated on << .TokenSecret >> (see loop-planner.yml).
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
schedule:
|
|
- cron: "<< .BuilderCron >>"
|
|
|
|
permissions:
|
|
issues: write
|
|
|
|
concurrency:
|
|
group: loop-builder
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
dispatch:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Open an increment issue and dispatch the agent
|
|
env:
|
|
GH_TOKEN: ${{ secrets.<< .TokenSecret >> || github.token }}
|
|
HAS_TOKEN: ${{ secrets.<< .TokenSecret >> != '' }}
|
|
REPO: ${{ github.repository }}
|
|
RUN_NUMBER: ${{ github.run_number }}
|
|
run: |
|
|
if [ "$HAS_TOKEN" != "true" ]; then
|
|
echo "<< .TokenSecret >> is not set — skipping (see loop-planner.yml)."
|
|
exit 0
|
|
fi
|
|
ISSUE_URL=$(gh issue create --repo "$REPO" \
|
|
--title "Loop: build increment #$RUN_NUMBER" \
|
|
--body "Autonomous build increment. Direction: .github/loop/NORTH_STAR.md. Queue: .github/loop/PRIORITIES.md.")
|
|
ISSUE_NUM="${ISSUE_URL##*/}"
|
|
echo "Opened issue #$ISSUE_NUM — dispatching the builder."
|
|
gh issue comment "$ISSUE_NUM" --repo "$REPO" --body \
|
|
"<< .AgentMention >> Build one increment for this repository, aligned to .github/loop/NORTH_STAR.md. PICK THE WORK: take the highest-ranked item in .github/loop/PRIORITIES.md whose linked issue is still OPEN — that is your task and its issue is the one you close. If the queue is empty or every item's issue is closed, pick the single highest-value improvement yourself. Implement it, then VERIFY the project builds, tests, and lints (use the commands documented in the README or the CI workflow). Open the PR YOURSELF from the shell — do NOT use a make_pr tool (it may be a no-op stub): \`git switch -c loop/increment-$ISSUE_NUM\`, \`git push -u origin loop/increment-$ISSUE_NUM\`, \`gh pr create --base << .DefaultBranch >> --title \"<title>\" --body \"<body; include 'Closes #<the item's issue>' so it leaves the queue, and 'Closes #$ISSUE_NUM' for this tracker>\"\`, then \`gh pr merge --squash --auto --delete-branch\` so it lands on green CI. One concern per PR; stay out of breaking public API and brand/positioning copy."
|