fixtures.ts
This file
Path
packages/agent-kit/test/fixtures.ts
205 lines · 5.4 KiB · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–10why, one step back1import { Brand } from "@repo/brand";2import { CheckSpec } from "@repo/protocol/domain/check";3import { Command } from "@repo/protocol/domain/common";4import type { AskKind } from "@repo/protocol/domain/kind";5import { Policy } from "@repo/protocol/domain/policy";6import { LandedSha, ProjectName, RepoPath } from "@repo/protocol/ids";7import { Schema } from "effect";89import type { CommandDoc } from "../src/command-doc.ts";10Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
line 11why, one step back11export const project = ProjectName.make("oscabriel/datekit");Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 12–151why, one step back1213export const landed = LandedSha.make("a".repeat(40));1415export const later = LandedSha.make("b".repeat(40));1617const encodeCheck = Schema.encodeSync(CheckSpec);1819const fix: typeof AskKind.Encoded = {20 checkKind: "redThenGreen",21 claimers: "vouched",22 finish: "optional",23 name: "fix",24 oneWay: false,25 race: 1,26 requires: ["want", "check", "territory"],27 strength: "assertion",28};2930const lint: typeof AskKind.Encoded = {31 checkKind: "lintToZero",32 claimers: "anyone",33 finish: "never",34 name: "lint",35 oneWay: false,36 race: 2,37 requires: ["want", "check"],38 strength: "assertion",39};4041const parse = { module: "parse", paths: ["packages/parse/**"] } as const;4243const format = { module: "format", paths: ["packages/format/**"] } as const;4445const askedBy = "alice";4647const openedAt = "2026-10-07T12:00:00.000Z";4849const encoded: typeof Policy.Encoded = {50 agents: "trailer",51 asks: [52 {53 askedBy,54 blockedBy: [],55 brief: { want: "Parsing an ISO week date gives that week's Monday." },56 check: encodeCheck(57 CheckSpec.cases.RedThenGreen.make({58 path: RepoPath.make("packages/parse/test/iso-week.test.ts"),59 })60 ),61 file: `${Brand.configDir}/asks/iso-week.ask.ts`,62 id: "iso-week",63 kind: "fix",64 openedAt,65 openedIn: landed,66 project,67 state: "open",68 territory: parse,69 },70 {71 askedBy,72 blockedBy: [],73 brief: {74 want: "Formatting a day of the month gives its English ordinal.",75 },76 check: encodeCheck(77 CheckSpec.cases.RedThenGreen.make({78 path: RepoPath.make("packages/format/test/ordinal.test.ts"),79 })80 ),81 file: `${Brand.configDir}/asks/ordinals.ask.ts`,82 id: "ordinals",83 kind: "fix",84 openedAt,85 openedIn: landed,86 project,87 state: "claimed",88 territory: format,89 },90 {91 askedBy,92 blockedBy: [],93 brief: { want: "The format module has no explicit any." },94 check: encodeCheck(95 CheckSpec.cases.LintToZero.make({96 command: Command.make("bunx oxlint --format json"),97 rule: "typescript/no-explicit-any",98 territory: "format",99 })100 ),101 file: `${Brand.configDir}/asks/no-any.ask.ts`,102 id: "no-any",103 kind: "lint",104 openedAt,105 openedIn: landed,106 project,107 state: "open",108 territory: format,109 },110 ],111 at: landed,112 budget: { decisionsPerDay: 5, expireDays: 14 },113 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },114 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },115 deciders: [{ handles: [askedBy], paths: "**" }],116 functions: { admit: false, opensAlone: false },117 judge: {118 paths: [`${Brand.configDir}/**`, "bunfig.toml", "tsconfig.json"],119 pointers: ["package.json#/scripts"],120 },121 kinds: [fix, lint],122 modules: [123 { ...parse, publicFiles: ["packages/parse/src/index.ts"] },124 { ...format, publicFiles: ["packages/format/src/index.ts"] },125 ],126 ratchets: [],127 record: { countsAfterDays: 30, windowDays: 365 },128 run: {129 checks: {130 lint: "bun run lint",131 types: "bun run typecheck",132 unit: "bun test",133 },134 test: "bun test {path}",135 },136 source: "config",137 vouch: { file: `${Brand.configDir}/vouched.td`, mode: "forCode" },138 vouches: [],139 weakening: { markers: [".skip(", ".only(", "@ts-ignore"] },140};141142export const policy = Schema.decodeSync(Policy)(encoded);143144export const policyWithNewLint = Schema.decodeSync(Policy)({145 ...encoded,146 run: {147 ...encoded.run,148 checks: { ...encoded.run.checks, lint: "bunx oxlint --deny-warnings" },149 },150});151Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
line 152why, one step back152// Hand-written, so a contract's wording changing elsewhere leaves the golden files alone.Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 153–205why, one step back153export const commands: readonly CommandDoc[] = [154 {155 contract: "listAsks",156 flags: ["--project", "--json"],157 needsApproval: false,158 path: ["asks"],159 positional: [],160 readOnly: true,161 source: "contract",162 summary: "List a project's open asks.",163 },164 {165 contract: "claim",166 flags: ["--project", "--json", "--dry-run"],167 needsApproval: false,168 path: ["claim"],169 positional: ["ask"],170 readOnly: false,171 source: "contract",172 summary:173 "Claim an ask: an exclusive, expiring right to answer it, with a fork to push to; claiming it again returns the same claim.",174 },175 {176 contract: "vouch",177 flags: [178 "--project",179 "--handle",180 "--verdict",181 "--note",182 "--json",183 "--yes",184 "--dry-run",185 ],186 needsApproval: true,187 path: ["vouch"],188 positional: [],189 readOnly: false,190 source: "contract",191 summary:192 "Vouch for a person, or denounce them, by landing a line in the project's vouch file.",193 },194 {195 flags: ["--ask", "--project", "--base", "--json"],196 needsApproval: false,197 path: ["check"],198 positional: [],199 readOnly: true,200 source: "local",201 summary: "Run the gate's checks on your answer locally, before you push.",202 },203];204205export const platformUrl = `https://${Brand.domain}`;