Skip to content
Myr

judge.ts

This file

Path

apps/cli/src/hook/judge.ts

49 lines · 1.6 KiB · TypeScript

Last changed by

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

History of this file

Take 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–29why, one step back
1import { findRunBlock } from "@repo/checks/finder";
2import { judgeClosure } from "@repo/checks/judge";3import type { Ask } from "@repo/protocol/domain/ask";4import { CheckSpec } from "@repo/protocol/domain/check";5import { Command, Glob } from "@repo/protocol/domain/common";6import type { Policy } from "@repo/protocol/domain/policy";7import { RunBlock } from "@repo/protocol/domain/run";8import { Array, Effect, Option, Schema } from "effect";9import type { ChildProcessSpawner } from "effect/process";1011import { judgeFilesAt } from "../local/judge-files.ts";1213export const askJudge = (14 closure: Policy["judge"],15 ask: Ask16): Policy["judge"] => {17 const own = [18 ask.file,19 ...(CheckSpec.guards.RedThenGreen(ask.check) ? [ask.check.path] : []),20 ].map((path) => Glob.make(`/${path}`));2122 return {23 paths: Array.dedupe([...closure.paths, ...own]),24 pointers: closure.pointers,25 };26};2728const decodeRun = Schema.decodeUnknownOption(RunBlock);29

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

line 30why, one step back
30/** The config folder's run block needs the config evaluated, which only `<cli> check` does, so the claim's check command stands in. */

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 31–49why, one step back
31export const judgeAt = (input: {
32 readonly root: string;33 readonly base: string;34 readonly test: string;35}): Effect.Effect<36 Policy["judge"],37 never,38 ChildProcessSpawner.ChildProcessSpawner39> =>40 Effect.map(judgeFilesAt(input.root, input.base), (files) => {41 const found = findRunBlock(files).run;4243 const run = Option.getOrElse(44 decodeRun({ checks: {}, test: input.test, ...found }),45 (): RunBlock => ({ checks: {}, test: Command.make(input.test) })46 );4748 return judgeClosure(run, files);49 });