mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-10-25 14:00:40 +00:00
fix(agent): align compact dispatcher guidance
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
pad "github.com/PerpetualSoftware/pad"
|
||||
"github.com/PerpetualSoftware/pad/internal/cli"
|
||||
)
|
||||
|
||||
const guideFixture = `# Pad
|
||||
@@ -45,3 +49,23 @@ func TestAgentGuideSectionRejectsUnknownTopic(t *testing.T) {
|
||||
t.Fatal("unknown topic resolved")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentDispatcherGuideTopicsResolve(t *testing.T) {
|
||||
dispatcher := cli.FormatForTool(*cli.ResolveTool("agents"), pad.PadSkill)
|
||||
guide := string(cli.StripFrontmatter(pad.PadSkill))
|
||||
matches := regexp.MustCompile(`pad agent guide ([a-z0-9][a-z0-9-]*)`).FindAllSubmatch(dispatcher, -1)
|
||||
seen := map[string]bool{}
|
||||
for _, match := range matches {
|
||||
topic := string(match[1])
|
||||
if topic == "all" || seen[topic] {
|
||||
continue
|
||||
}
|
||||
seen[topic] = true
|
||||
if _, ok := agentGuideSection(guide, topic); !ok {
|
||||
t.Errorf("dispatcher guide topic %q does not resolve", topic)
|
||||
}
|
||||
}
|
||||
if len(seen) == 0 {
|
||||
t.Fatal("dispatcher contains no guide topics")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ playbooks, dashboard, and recent activity in one call.
|
||||
- Read an item before updating it. Send only changed fields and include a comment
|
||||
with status changes.
|
||||
- Read collection schemas instead of guessing field names or terminal statuses.
|
||||
- Never read ` + "`~/.pad/attachments/`" + ` directly. Always use ` + "`pad attachment`" + `.
|
||||
- Confirm each mutation from the returned object before saying it succeeded.
|
||||
- Use active playbooks when intent or an invocation slug matches; never run draft
|
||||
or deprecated playbooks unless the user explicitly asks.
|
||||
@@ -125,7 +126,7 @@ pad item show TASK-5 --format json
|
||||
pad item list [collection] --format json
|
||||
pad item create <collection> "Title" [flags]
|
||||
pad item update TASK-5 [flags]
|
||||
pad item comment TASK-5 -m "Message"
|
||||
pad item comment TASK-5 "Message"
|
||||
pad playbook list --format json
|
||||
pad playbook show <slug> --format markdown
|
||||
` + "```" + `
|
||||
|
||||
Reference in New Issue
Block a user