|
| 1 | +import { describe, expect, test } from "bun:test"; |
| 2 | +import { wardenPackage } from "./package.js"; |
| 3 | + |
| 4 | +describe("wardenPackage", () => { |
| 5 | + test("id matches directory", () => { |
| 6 | + expect(wardenPackage.id).toBe("warden"); |
| 7 | + }); |
| 8 | + |
| 9 | + test("systemPrompt is real, not a placeholder", () => { |
| 10 | + expect(wardenPackage.systemPrompt.length).toBeGreaterThan(0); |
| 11 | + expect(wardenPackage.systemPrompt.startsWith("Placeholder")).toBe(false); |
| 12 | + }); |
| 13 | + |
| 14 | + test("systemPrompt states PRIMARY INTENT", () => { |
| 15 | + expect(wardenPackage.systemPrompt).toMatch(/PRIMARY INTENT/i); |
| 16 | + }); |
| 17 | + |
| 18 | + test("systemPrompt identity is Warden / WardenDirector", () => { |
| 19 | + const p = wardenPackage.systemPrompt; |
| 20 | + expect(p).toMatch(/WardenDirector \(Warden\)/); |
| 21 | + expect(p).toMatch(/trust lane only/i); |
| 22 | + }); |
| 23 | + |
| 24 | + test("systemPrompt trigger is written trust paths only", () => { |
| 25 | + const p = wardenPackage.systemPrompt; |
| 26 | + expect(p).toMatch(/TRIGGER/i); |
| 27 | + expect(p).toMatch(/permission/); |
| 28 | + expect(p).toMatch(/provider-auth/); |
| 29 | + expect(p).toMatch(/plugin-loader/); |
| 30 | + expect(p).toMatch(/Anything else is out of lane/); |
| 31 | + expect(p).toMatch(/Do not expand into general code review/); |
| 32 | + }); |
| 33 | + |
| 34 | + test("systemPrompt findings lens covers the trust surface", () => { |
| 35 | + const p = wardenPackage.systemPrompt; |
| 36 | + expect(p).toMatch(/Findings lens/i); |
| 37 | + expect(p).toMatch(/grant-matching holes/i); |
| 38 | + expect(p).toMatch(/secret-guard bypass/i); |
| 39 | + expect(p).toMatch(/arktype boundary skips/i); |
| 40 | + expect(p).toMatch(/shell-policy peel gaps/i); |
| 41 | + expect(p).toMatch(/plugin trust/i); |
| 42 | + expect(p).toMatch(/blocking, should-fix, or file-for-later/i); |
| 43 | + }); |
| 44 | + |
| 45 | + test("systemPrompt is evidence-based findings, never-fix", () => { |
| 46 | + const p = wardenPackage.systemPrompt; |
| 47 | + expect(p).toMatch(/evidence/); |
| 48 | + expect(p).toMatch(/never fix/i); |
| 49 | + expect(p).toMatch(/Do not ship fixes/); |
| 50 | + expect(p).toMatch(/permanent tests/i); |
| 51 | + expect(p).toContain("testsmith/builder"); |
| 52 | + expect(p).toContain("route to builder"); |
| 53 | + }); |
| 54 | + |
| 55 | + test("systemPrompt is not a second critic or greybeard", () => { |
| 56 | + const p = wardenPackage.systemPrompt; |
| 57 | + expect(p).toMatch(/Do not become critic/); |
| 58 | + expect(p).toMatch(/greybeard/); |
| 59 | + }); |
| 60 | + |
| 61 | + test("systemPrompt has no tool-schema restatement or fake caps", () => { |
| 62 | + const p = wardenPackage.systemPrompt; |
| 63 | + expect(p).not.toMatch(/parameters?:/i); |
| 64 | + expect(p).not.toMatch(/fan-out/i); |
| 65 | + expect(p).not.toMatch(/at most \d+/i); |
| 66 | + expect(p).not.toMatch(/turn budget/i); |
| 67 | + expect(p).not.toMatch(/scheduler/i); |
| 68 | + expect(p).not.toMatch(/Prefer grep\/search_files/i); |
| 69 | + expect(p).not.toMatch(/Shell find\/rg/i); |
| 70 | + expect(p).not.toMatch(/Write tools are not mounted/i); |
| 71 | + expect(p).not.toMatch(/via run_shell/i); |
| 72 | + }); |
| 73 | + |
| 74 | + test("spawn.maySpawn is false", () => { |
| 75 | + expect(wardenPackage.spawn.maySpawn).toBe(false); |
| 76 | + }); |
| 77 | + |
| 78 | + test("tier is leaf", () => { |
| 79 | + expect(wardenPackage.tier).toBe("leaf"); |
| 80 | + }); |
| 81 | + |
| 82 | + test("tools.allow is review surface with product writes", () => { |
| 83 | + const allow = wardenPackage.tools?.allow ?? []; |
| 84 | + expect(allow).toContain("read_file"); |
| 85 | + expect(allow).not.toContain("use_skill"); |
| 86 | + expect(allow).toContain("write_file"); |
| 87 | + expect(allow).toContain("edit_file"); |
| 88 | + expect(allow).toContain("delete_file"); |
| 89 | + }); |
| 90 | + |
| 91 | + test("modelRole is review", () => { |
| 92 | + expect(wardenPackage.modelRole).toBe("review"); |
| 93 | + }); |
| 94 | + |
| 95 | + test("optionalSkills order is style, philosophy, native-integration, idiot-proof", () => { |
| 96 | + expect(wardenPackage.optionalSkills).toEqual([ |
| 97 | + "style", |
| 98 | + "philosophy", |
| 99 | + "native-integration", |
| 100 | + "idiot-proof", |
| 101 | + ]); |
| 102 | + }); |
| 103 | + |
| 104 | + test("primaryIntent and outOfLane match warden lane", () => { |
| 105 | + expect(wardenPackage.primaryIntent).toBe( |
| 106 | + "Trust review of permission, provider-auth, and plugin-loader diffs; never fix product code", |
| 107 | + ); |
| 108 | + expect(wardenPackage.outOfLane).toContain("implementing fixes"); |
| 109 | + expect(wardenPackage.outOfLane).toContain( |
| 110 | + "general code review outside trust paths", |
| 111 | + ); |
| 112 | + expect(wardenPackage.outOfLane).toContain( |
| 113 | + "architecture judgment without trust evidence", |
| 114 | + ); |
| 115 | + expect(wardenPackage.outOfLane).toContain("feature design"); |
| 116 | + }); |
| 117 | +}); |
0 commit comments