feat(agentic): add pr-manage command alias
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
f5dff3d822
commit
b20978f8d3
3 changed files with 41 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ func (s *PrepSubsystem) registerCommands(ctx context.Context) {
|
|||
c.Command("brain/ingest", core.Command{Description: "Bulk ingest memories into OpenBrain", Action: s.cmdBrainIngest})
|
||||
c.Command("brain/seed-memory", core.Command{Description: "Import markdown memories into OpenBrain from a project memory directory", Action: s.cmdBrainSeedMemory})
|
||||
c.Command("plan-cleanup", core.Command{Description: "Permanently delete archived plans past the retention period", Action: s.cmdPlanCleanup})
|
||||
c.Command("pr-manage", core.Command{Description: "Manage open PRs (merge, close, review)", Action: s.cmdPRManage})
|
||||
c.Command("status", core.Command{Description: "List agent workspace statuses", Action: s.cmdStatus})
|
||||
c.Command("prompt", core.Command{Description: "Build and display an agent prompt for a repo", Action: s.cmdPrompt})
|
||||
c.Command("extract", core.Command{Description: "Extract a workspace template to a directory", Action: s.cmdExtract})
|
||||
|
|
|
|||
|
|
@ -875,11 +875,18 @@ func TestCommands_RegisterCommands_Good_AllRegistered(t *testing.T) {
|
|||
assert.Contains(t, cmds, "plan/list")
|
||||
assert.Contains(t, cmds, "plan/show")
|
||||
assert.Contains(t, cmds, "plan/status")
|
||||
assert.Contains(t, cmds, "pr-manage")
|
||||
assert.Contains(t, cmds, "task")
|
||||
assert.Contains(t, cmds, "task/update")
|
||||
assert.Contains(t, cmds, "task/toggle")
|
||||
}
|
||||
|
||||
func TestCommands_CmdPRManage_Good_NoCandidates(t *testing.T) {
|
||||
s, _ := testPrepWithCore(t, nil)
|
||||
r := s.cmdPRManage(core.NewOptions())
|
||||
assert.True(t, r.OK)
|
||||
}
|
||||
|
||||
// --- CmdExtract Bad/Ugly ---
|
||||
|
||||
func TestCommands_CmdExtract_Bad_TargetDirAlreadyHasFiles(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,39 @@ func (s *PrepSubsystem) registerReviewQueueTool(server *mcp.Server) {
|
|||
}, s.reviewQueue)
|
||||
}
|
||||
|
||||
// result := c.Command("pr-manage").Run(ctx, core.NewOptions(
|
||||
//
|
||||
// core.Option{Key: "limit", Value: 4},
|
||||
//
|
||||
// ))
|
||||
func (s *PrepSubsystem) cmdPRManage(options core.Options) core.Result {
|
||||
ctx := s.commandContext()
|
||||
input := ReviewQueueInput{
|
||||
Limit: optionIntValue(options, "limit"),
|
||||
Reviewer: optionStringValue(options, "reviewer"),
|
||||
DryRun: optionBoolValue(options, "dry-run"),
|
||||
LocalOnly: optionBoolValue(options, "local-only"),
|
||||
}
|
||||
|
||||
_, output, err := s.reviewQueue(ctx, nil, input)
|
||||
if err != nil {
|
||||
core.Print(nil, "error: %v", err)
|
||||
return core.Result{Value: err, OK: false}
|
||||
}
|
||||
|
||||
if output.RateLimit != nil && output.RateLimit.Message != "" {
|
||||
core.Print(nil, "rate limit: %s", output.RateLimit.Message)
|
||||
}
|
||||
for _, item := range output.Processed {
|
||||
core.Print(nil, "%s: %s (%s)", item.Repo, item.Verdict, item.Action)
|
||||
}
|
||||
for _, item := range output.Skipped {
|
||||
core.Print(nil, "skipped: %s", item)
|
||||
}
|
||||
|
||||
return core.Result{Value: output, OK: true}
|
||||
}
|
||||
|
||||
func (s *PrepSubsystem) reviewQueue(ctx context.Context, _ *mcp.CallToolRequest, input ReviewQueueInput) (*mcp.CallToolResult, ReviewQueueOutput, error) {
|
||||
limit := input.Limit
|
||||
if limit <= 0 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue