| 1 | package aviso |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "strings" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | // skillBudget is the byte ceiling for SKILL.md. It is what an agent |
| 10 | // loads instead of reading the source, so it is reviewed like code and |
| 11 | // kept short; raise it here, with a reason, rather than trimming a |
| 12 | // load-bearing fact to fit. |
| 13 | const skillBudget = 9000 |
| 14 | |
| 15 | func TestSkillMDIsWithinBudgetAndNamesTheSurface(t *testing.T) { |
| 16 | b, err := os.ReadFile("SKILL.md") |
| 17 | if err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | if len(b) > skillBudget { |
| 21 | t.Fatalf("SKILL.md is %d bytes, budget %d", len(b), skillBudget) |
| 22 | } |
| 23 | s := string(b) |
| 24 | for _, want := range []string{ |
| 25 | "aviso.New", "aviso.Schema", "BootSchema", "PrivateKey", "aviso-key", |
| 26 | "SendTo", "Send(", "Sweep", "DeleteSubject", |
| 27 | "PublicKey", "Subscribe", "Unsubscribe", |
| 28 | "JS()", "WorkerJS()", "importScripts", "enable(", "reconcile(", "disable(", |
| 29 | "handlePush", "handleClick", "handleSubscriptionChange", "fallback", "publicKey:", |
| 30 | "docs/installable.md", "3993", "24 hours", |
| 31 | } { |
| 32 | if !strings.Contains(s, want) { |
| 33 | t.Errorf("SKILL.md does not mention %q", want) |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |