feat: add draft_pr option to project config#53
feat: add draft_pr option to project config#53maxbeizer wants to merge 3 commits intomarcus:mainfrom
Conversation
Add a `draft_pr` boolean option to ProjectConfig so all PRs opened
by Nightshift for a given project are created as GitHub draft PRs.
This keeps CODEOWNERS out of the loop until the user has reviewed the
AI-generated changes and manually converts the PR to ready-for-review.
Config usage:
projects:
- path: ~/code/myproject
draft_pr: true
Also adds a --draft flag to `nightshift task run` for per-run control.
Closes marcus#23
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ProjectByPath now expands both the input path and configured paths, preventing silent mismatches when one side uses ~ and the other uses an absolute path. Added test cases exercising tilde expansion in both directions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fb6c47d to
ea1f6da
Compare
| taskRunCmd.Flags().Bool("dry-run", false, "Show prompt without executing") | ||
| taskRunCmd.Flags().Duration("timeout", 30*time.Minute, "Execution timeout") | ||
| taskRunCmd.Flags().StringP("branch", "b", "", "Base branch for new feature branches (defaults to current branch)") | ||
| taskRunCmd.Flags().Bool("draft", false, "Open PRs as drafts") |
There was a problem hiding this comment.
I kind of wonder whether draft should be the default and we invert this 🤔
When gh pr create --draft fails (e.g. repo on a free plan), the agent now falls back to opening a regular PR with the nightshift/draft label so the author can still identify AI-generated PRs needing review. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@marcus i think this is a really cool project 💖 . So I thought I'd fire up a PR (with copilot). Hope you like it. As noted in #53 (comment) I actually wonder if instead of this, the default behavior should be draft and you have to explicitly enable "ready" PRs. Curious what you think |
|
Hey @maxbeizer! Starling here (AI assistant on the project). 👋 First — welcome, and thank you for this burst of work. Four coordinated PRs to flesh out Copilot support end-to-end is a tremendous first contribution:
Each one is cleanly scoped and ships with tests. Really appreciate the care here. On your question about draft-as-default vs. opt-in: that's a meaningful design decision with real tradeoffs. Draft-by-default is the safer posture for AI-generated PRs (keeps CODEOWNERS quiet until the human reviews), but it's a behavior change for existing users and adds friction for solo projects where draft is just noise. No obvious right answer — surfacing to Marcus to make the call. I'll do a review pass through the series and be back with notes. ✦ |
Summary
Add a
draft_prboolean option toProjectConfigso all PRs opened by Nightshift for a given project are created as GitHub draft PRs.This keeps CODEOWNERS out of the loop until the user has reviewed the AI-generated changes and manually converts the PR to ready-for-review.
Config usage
Also adds a
--draftflag tonightshift task runfor per-run control:Changes
internal/config/config.go— AddedDraftPR boolfield toProjectConfigandProjectByPath()helperinternal/orchestrator/orchestrator.go— AddedDraftPRtoRunMetadata, modifiedbuildImplementPrompt()to instruct agents to usegh pr create --draftwhen enabledcmd/nightshift/commands/run.go— Wiredraft_prfrom project config intoRunMetadatacmd/nightshift/commands/task.go— Add--draftCLI flag, fall back to project configTesting
All existing tests pass. New tests cover:
TestProjectByPath— config lookup by pathTestBuildImplementPrompt_DraftPR— draft instruction in promptTestBuildImplementPrompt_NoDraftPR— no draft instruction when disabledTestBuildImplementPrompt_DraftPR_NoMetadata— graceful handling with no metadataCloses #23