feat(gate): hew gate primitive + /hew:ship skill fix (hew-y4sf, hew-pi36)#51
Merged
Merged
Conversation
…l fix
Adds `hew gate new/poll/list` for tasks that wait on an external
condition (currently: a GitHub PR being merged). The skill body for
/hew:ship now points at this primitive instead of the bd flags that
never existed (`--type=gate --await-type=gh:pr --await-id=N`).
Closes hew-y4sf, hew-pi36.
Substrate (`hew_core::external_gate`):
- `GateKind { GhPr { id } }` — extensible enum with `kind: gh:pr` serde tag
- `GateSpec` — typed wrapper, round-trips through bd's `--metadata` blob
under a top-level `"hew_gate"` key
- `classify_gh_pr_view` — MERGED resolves, OPEN/CLOSED-not-merged stay
pending, unknown state surfaces as Indeterminate (operator decides)
CLI (`hew gate`):
- `new --gh-pr=N --title=T` creates a bd task with the typed metadata
+ `hew-gate` label, parses the new id out of bd's `--json` output
- `poll [<id>]` reads each open gate's spec, calls `gh pr view N
--json state,mergedAt`, classifies, closes resolved tasks with a
reason that carries the mergedAt timestamp
- `list` filters bd's open issues to the `hew-gate` label
Resilience:
- bd 1.0.3's `show --json` wraps the issue in a one-element array;
parser accepts both array-wrapped and bare-object forms
- bd's `list --json` has varied across versions between top-level
array and `{"issues":[...]}` envelope; parser accepts both
- Strict on metadata read: missing `hew_gate` key fails loudly rather
than silently coercing into the wrong shape
Smoke-tested end-to-end:
- Created gate against merged PR #49 → poll closed task with reason
"PR merged at 2026-05-29T09:07:45Z"
- Created gate against nonexistent PR #9999 → poll surfaced
`gh pr view 9999 exited Some(1): GraphQL: Could not resolve...`
as Indeterminate, gate stayed open
Also tightens .gitignore: `**/.hew/loop/` now catches loop artifacts
from tests/smoke runs inside subcrates, not just the workspace root.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
droidnoob
added a commit
that referenced
this pull request
May 29, 2026
Same ghost primitive caught in ship.md (PR #51) and hew-decompose.md (PR #52): bd's --type enum doesn't include `gate`, and the dedicated hew gate command now owns external-state gating. - skills/SKILL.md: "Beads has native types: --type=gate, --type=epic, bd mol bond" rewritten. --type=gate is gone; epic/decision are surfaced as the real typed surfaces; bd mol bond now correctly flagged as broken-don't-use rather than recommended. - skills/core/hew-plan.md: the hand-off line that mentioned `bd create --type=gate` now points at `hew gate new --gh-pr=N` and recommends `bd create --graph` for the task batch. Audit complete across all 22 skill files + 41 command files. No remaining ghost bd references. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hew gate— external-state gates +/hew:shipskill fixTwo follow-ups discovered during PR #49's ship process:
/hew:shipskill body documentsbd create --type=gate --await-type=gh:pr --await-id=N— those flags don't exist in bd v1.0.3 (--typeis closed enumbug|feature|task|epic|chore|decision; no--await-*). Skill body rewritten to use the new primitive below.hew gatefor tasks that wait on an external condition. v1 backend: GitHub PR merged.Usage
Architecture
Pure logic in
hew_core::external_gate(10 unit tests):GateKind { GhPr { id } }— tagged enum,kind: "gh:pr"serde tagGateSpec— wraps undermetadata.hew_gateso future hew-managed keys don't collideclassify_gh_pr_view—MERGEDresolves withmergedAtin the reason;OPENandCLOSED-without-mergestay pending (operator may reopen / re-push); unknown state →Indeterminateso the gate stays open and the operator sees a warning rather than an auto-close on something they didn't intendCLI in
hew/src/commands/gate.rs(11 unit tests):new→bd create --type=task --labels=hew-gate --metadata=… --json …, parses.idpoll→bd show <id> --json(accepts both bd 1.0.3's array-wrapped and bare-object shapes),gh pr view N --json state,mergedAt, classifies, closes viabd close <id> --reason …list→ text-modebd list --label hew-gate --status=openSmoke
PR merged at 2026-05-29T09:07:45Zgh pr view 9999 exited Some(1): GraphQL: Could not resolve…as Indeterminate, gate stayed openno open gate tasksQuality
cargo clippy --all-targets -- -D warningscleancargo fmt --checkclean.gitignore:**/.hew/loop/catches loop artifacts from subcrate test runsDeferred / scaffolded but not in v1
GhIssue,GhRun,Cmdbackends — theGateKindenum is extensible; add a variant + match arm inpoll_oneto wire each. Filed implicitly behind hew-y4sf since the design accommodates them; no new task needed unless a real use case shows up.🤖 Generated with Claude Code