feat: add ignore_drafts option to filter draft PRs from inbox#11
Conversation
## What
Adds an `ignore_drafts` config field (default false) and a matching
`--ignore-drafts` flag on `zen inbox`. When enabled, draft PRs are
filtered out of inbox results, watch-daemon poll output, and the MCP
inbox tool. The filter is applied at the GitHub search layer:
`draft:false` for GraphQL queries and `--draft=false` for `gh pr list`.
## Why
Avoid spending review attention on PRs that aren't ready for review.
The CLI flag overrides the persisted config in either direction for
single-run experiments.
## Notes
- The setting is honored by the watch daemon and MCP zen_inbox tool, not just zen inbox — a user enabling this will also stop receiving daemon notifications for drafts. Consistent on purpose, but worth flagging.
- Default behavior is unchanged for existing configs (drafts still shown).
- The flag uses cmd.Flags().Changed("ignore-drafts") so it only overrides config when explicitly set; bare zen inbox always uses config.
- --draft=false is a documented gh pr list flag; no new dependency.
Signed-off-by: jmeridth <jmeridth@gmail.com>
|
@mgreau I may want to flip this to be --open-only (ignores drafts and merged). wdyt? |
mgreau
left a comment
There was a problem hiding this comment.
LGTM — clean, well-scoped change with good test coverage.
On your question about flipping to --open-only: I'd keep --ignore-drafts.
The inbox search queries already pin is:pr is:open, so merged PRs are never in the result set today — GetReviewRequests, GetApprovedUnmerged, and ListOpenPRs all constrain to open. That means --open-only would functionally do exactly what --ignore-drafts does (filter drafts) but with a name that implies it's also responsible for excluding merged, which is actually is:open's job. The current name describes exactly what the flag does.
The only surface that shows merged PRs is zen status / dashboard, but that's a different code path entirely (local worktrees enriched via GetPRState, not a GitHub search), and merged worktrees stay visible there on purpose so you can clean them up before the watch daemon's cleanup pass. If you ever want to hide those, that'd be a separate flag on status, not a rename here.
One small non-blocking thing: the MCP zen_inbox tool has no per-call override and always uses s.cfg.IgnoreDrafts. Reasonable to keep the MCP surface minimal, but worth a one-line note in docs/mcp.md so anyone reading the CLI docs first doesn't get surprised.
## What Add a callout to docs/mcp.md clarifying that the zen_inbox MCP tool reads ignore_drafts from config only, with no per-call parameter override. ## Why The CLI accepts --ignore-drafts as a per-run flag while the MCP handler reads s.cfg.IgnoreDrafts directly. A reader coming from the CLI docs could reasonably expect the same toggle on the tool call and be surprised when it isn't there. ## Notes - Documentation only, no behavior change. - If a per-call override is added later, this note should be removed rather than amended. Signed-off-by: jmeridth <jmeridth@gmail.com>
What
Adds an
ignore_draftsconfig field (defaultfalse) and a matching--ignore-draftsflag onzen inbox. When enabled, draft PRs are filtered out of inbox results, watch-daemon poll output, and the MCPzen_inboxtool. The filter is applied at the GitHub search layer:draft:falsefor GraphQL queries and--draft=falseforgh pr list.Also adds a callout in
docs/mcp.mdclarifying that the MCPzen_inboxtool readsignore_draftsfrom config only, with no per-call override (unlike the CLI flag).Why
Avoid spending review attention on PRs that aren't ready for review. The CLI flag overrides the persisted config in either direction for single-run experiments.
Notes
zen_inboxtool, not justzen inbox. A user enabling this will also stop receiving daemon notifications for drafts. Consistent on purpose, but worth flagging during review.false) for the new bool naturally preserves prior behavior, so no pointer/getter dance needed.cmd.Flags().Changed("ignore-drafts")so it only overrides config when explicitly set; barezen inboxalways uses config.--draft=falseis a documentedgh pr listflag, no new dependency.zen_inboxintentionally has no per-call override parameter; toggling requires a config change. Documented indocs/mcp.md.Testing
TestLoadIgnoreDrafts— verifies omitted/true/falseYAML round-trip intoConfig.IgnoreDrafts.TestBuildReviewRequestQueries— confirmsdraft:falseis appended to both review-requested and re-review GraphQL search strings under all repo-filter combinations.TestBuildApprovedUnmergedQuery— same coverage for the approved-unmerged query.*_timeoutErrortests updated for the newignoreDraftsparameter.go vet ./...,go test ./...,go build ./...all pass.zen inbox --ignore-draftsagainst a repo with open draft PRs to confirm end-to-end behavior with the liveghCLI. Also worked with config option set to true.