@r_masseater/msch 0.84.0 → 0.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/changed.mjs +1 -1
- package/dist/cli.mjs +3 -4
- package/dist/cli.mjs.map +1 -1
- package/dist/config-BBdsNPSO.mjs +9 -0
- package/dist/config-BBdsNPSO.mjs.map +1 -0
- package/dist/config.mjs +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-Cmdgaxwj.mjs → define-lint-preset-ALNtaoIc.mjs} +4 -5
- package/dist/define-lint-preset-ALNtaoIc.mjs.map +1 -0
- package/dist/exits.mjs +1 -1
- package/dist/judge.d.mts +1 -0
- package/dist/judge.mjs +415 -0
- package/dist/judge.mjs.map +1 -0
- package/dist/lint-rules.mjs +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/{lookup-report-BdUByHMt.mjs → lookup-report-VID9QVGU.mjs} +2 -2
- package/dist/{lookup-report-BdUByHMt.mjs.map → lookup-report-VID9QVGU.mjs.map} +1 -1
- package/dist/{output-BUCq_3DP.mjs → output-DYnV3b5B.mjs} +8 -3
- package/dist/output-DYnV3b5B.mjs.map +1 -0
- package/dist/published.mjs +1 -1
- package/dist/refs.mjs +1 -1
- package/dist/unbumped.mjs +1 -1
- package/dist/upstream.mjs +1 -1
- package/package.json +3 -2
- package/skills/msch-checks/SKILL.md +11 -0
- package/dist/config-C3jRfgJ9.mjs +0 -7
- package/dist/config-C3jRfgJ9.mjs.map +0 -1
- package/dist/define-lint-preset-Cmdgaxwj.mjs.map +0 -1
- package/dist/output-BUCq_3DP.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge.mjs","names":["Arr","Str","Arr","encodeJson","Str","Arr","Arr","Arr","Str","Arr","Arr"],"sources":["../src/features/judge-documents/model/agent-prompt.ts","../src/features/judge-documents/model/verdict.ts","../src/features/judge-documents/model/agent-judge.ts","../src/features/judge-documents/model/decision-judge.ts","../src/features/judge-documents/model/judge-rules.ts","../src/features/judge-documents/model/judge-cache.ts","../src/features/judge-documents/model/judge-input.ts","../src/features/judge-documents/model/judge-pairs.ts","../src/features/judge-documents/model/judge-repository.ts","../bin/msch-judge.ts"],"sourcesContent":["import { Array as Arr, Schema, pipe } from \"effect\";\n\nimport type { AgentInput } from \"./judge-input.ts\";\n\n/** @internal */\nexport const AgentAnswer = Schema.Struct({\n verdict: Schema.Literals([\"violation\", \"pass\", \"unknown\"]),\n quote: Schema.String,\n reason: Schema.String,\n});\n\n/** @internal */\nexport const AGENT_SCHEMA = Schema.toJsonSchemaDocument(AgentAnswer).schema;\n\n/** @internal */\nexport const AGENT_PROMPT_VERSION = 1;\n\nconst listOf = (names: readonly string[]): string =>\n pipe(\n names,\n Arr.map((name) => `- ${name}`),\n Arr.join(\"\\n\"),\n );\n\nconst readableNames = (context: AgentInput[\"context\"]): readonly string[] =>\n pipe(\n context,\n Arr.map(({ name }) => name),\n );\n\n/** @internal */\nexport const promptOf = ({ rule, target, context }: AgentInput): string =>\n pipe(\n [\n \"Judge one rule against one file. The working directory holds only the files you may read.\",\n `Rule: ${rule.question}`,\n `Target file: ${target.name}`,\n \"Other readable files:\",\n listOf(readableNames(context)),\n \"Read the target file, and read the other files when the rule needs them.\",\n 'Answer \"violation\" only when the target file breaks the rule, \"pass\" when it does not, and \"unknown\" when these files do not let you decide.',\n \"For a violation, copy the offending text from the target file exactly as written into quote, without paraphrase and without added or removed characters. Leave quote empty otherwise.\",\n \"Give the reason in one sentence.\",\n ],\n Arr.join(\"\\n\"),\n );\n","import { Array as Arr, Option, Schema, String as Str, pipe } from \"effect\";\n\nconst LINE_BREAK = \"\\n\";\nconst FIRST_LINE = 1;\nconst START = 0;\n\nconst Violation = Schema.Struct({\n status: Schema.Literal(\"violation\"),\n line: Schema.Int,\n quote: Schema.String,\n reason: Schema.String,\n});\n\nconst Pass = Schema.Struct({ status: Schema.Literal(\"pass\") });\n\nconst Unknown = Schema.Struct({ status: Schema.Literal(\"unknown\"), reason: Schema.String });\n\n/** @internal */\nexport const DecidedVerdictSchema = Schema.Union([Violation, Pass]);\n\n/** @internal */\nexport type DecidedVerdict = typeof DecidedVerdictSchema.Type;\n\n/** @internal */\nexport type Verdict = DecidedVerdict | typeof Unknown.Type;\n\n/** @internal */\nexport const unknownBecause = (reason: string): Verdict => ({ status: \"unknown\", reason });\n\n/** @internal */\nexport const isDecided = (verdict: Verdict): verdict is DecidedVerdict =>\n verdict.status !== \"unknown\";\n\n/** @internal */\nexport const lineOfQuote = ({\n text,\n quote,\n}: {\n readonly text: string;\n readonly quote: string;\n}): Option.Option<number> => {\n if (Str.isEmpty(quote)) {\n return Option.none();\n }\n return pipe(\n Str.indexOf(quote)(text),\n Option.map((index) => pipe(Str.slice(START, index)(text), Str.split(LINE_BREAK)).length),\n );\n};\n\n/** @internal */\nexport const textOfLine = ({\n text,\n line,\n}: {\n readonly text: string;\n readonly line: number;\n}): string =>\n pipe(\n Str.split(text, LINE_BREAK),\n Arr.get(line - FIRST_LINE),\n Option.getOrElse(() => \"\"),\n );\n","import type { Array as Arr } from \"effect\";\nimport { Effect, FileSystem, Option, Path, Schema, Stream, String as Str, pipe } from \"effect\";\nimport { ChildProcess } from \"effect/process\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { AGENT_PROMPT_VERSION, AGENT_SCHEMA, AgentAnswer, promptOf } from \"./agent-prompt.ts\";\nimport type { AgentInput, JudgedFile } from \"./judge-input.ts\";\nimport type { Judge } from \"./judge.ts\";\nimport { lineOfQuote, unknownBecause } from \"./verdict.ts\";\nimport type { Verdict } from \"./verdict.ts\";\n\nconst AGENT_MODEL = \"claude-sonnet-5-5\";\nconst AGENT_EFFORT = \"medium\";\nconst AGENT_TOOLS = \"Read,Grep,Glob\";\nconst AGENT_TIMEOUT = \"10 minutes\";\nconst SUCCESS = 0;\nconst STDERR_TAIL = 400;\n\n/** @internal */\nexport interface AgentSetup {\n readonly command: Arr.NonEmptyReadonlyArray<string>;\n}\n\n/** @internal */\nexport const CLAUDE: AgentSetup = { command: [\"claude\"] };\n\nconst ClaudeResult = Schema.Struct({\n is_error: Schema.Boolean,\n structured_output: Schema.optional(AgentAnswer),\n});\n\nconst decodeResult = Schema.decodeUnknownEffect(Schema.fromJsonString(ClaudeResult));\n\nconst encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst argsOf = (input: AgentInput, schema: string): readonly string[] => [\n \"-p\",\n promptOf(input),\n \"--model\",\n AGENT_MODEL,\n \"--effort\",\n AGENT_EFFORT,\n \"--restricted\",\n \"--tools\",\n AGENT_TOOLS,\n \"--strict-mcp-config\",\n \"--disable-slash-commands\",\n \"--no-session-persistence\",\n \"--permission-mode\",\n \"dontAsk\",\n \"--permission-prompts\",\n \"none\",\n \"--output-format\",\n \"json\",\n \"--json-schema\",\n schema,\n];\n\nconst sandboxOf = Effect.fn(\"sandboxOf\")(function* sandboxOf(files: readonly JudgedFile[]) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const directory = yield* fs.makeTempDirectoryScoped({ prefix: \"msch-judge-\" });\n yield* Effect.forEach(\n files,\n ({ name, text }) => {\n const file = path.join(directory, name);\n return fs\n .makeDirectory(path.dirname(file), { recursive: true })\n .pipe(Effect.andThen(fs.writeFileString(file, text)));\n },\n { concurrency: \"unbounded\", discard: true },\n );\n return directory;\n});\n\nconst textOf = <Failure, Requirements>(\n stream: Stream.Stream<Uint8Array, Failure, Requirements>,\n): Effect.Effect<string, Failure, Requirements> =>\n stream.pipe(Stream.decodeText(), Stream.mkString);\n\nconst runClaude = Effect.fn(\"runClaude\")(function* runClaude(\n setup: AgentSetup,\n call: { readonly directory: string; readonly args: readonly string[] },\n) {\n const [command, ...prefix] = setup.command;\n const handle = yield* ChildProcess.make(command, [...prefix, ...call.args], {\n cwd: call.directory,\n stdin: \"ignore\",\n });\n const [stdout, stderr, code] = yield* Effect.all(\n [textOf(handle.stdout), textOf(handle.stderr), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n if (Number(code) !== SUCCESS) {\n return yield* Effect.fail(\n `claude exited with ${String(code)}: ${pipe(stderr, Str.trim, Str.takeRight(STDERR_TAIL))}`,\n );\n }\n return stdout;\n});\n\nconst verdictOf = (target: JudgedFile, answer: typeof AgentAnswer.Type): Verdict => {\n if (answer.verdict === \"pass\") {\n return { status: \"pass\" };\n }\n if (answer.verdict === \"unknown\") {\n return unknownBecause(answer.reason);\n }\n return Option.match(lineOfQuote({ text: target.text, quote: answer.quote }), {\n onNone: () => unknownBecause(\"the quoted text is not in the target file\"),\n onSome: (line): Verdict => ({\n status: \"violation\",\n line,\n quote: answer.quote,\n reason: answer.reason,\n }),\n });\n};\n\nconst judgeIn = Effect.fn(\"agentJudge\")(function* judgeIn(setup: AgentSetup, input: AgentInput) {\n const directory = yield* sandboxOf([input.target, ...input.context]);\n const schema = yield* encodeJson(AGENT_SCHEMA);\n const stdout = yield* runClaude(setup, { directory, args: argsOf(input, schema) });\n const result = yield* decodeResult(stdout);\n const answer = Option.fromUndefinedOr(result.structured_output);\n if (result.is_error || Option.isNone(answer)) {\n return unknownBecause(\"claude returned no structured answer\");\n }\n return verdictOf(input.target, answer.value);\n});\n\nconst reasonOf = (failure: unknown): string => {\n if (typeof failure === \"string\") {\n return failure;\n }\n if (failure instanceof Error) {\n return failure.message;\n }\n return String(failure);\n};\n\n/** @internal */\nexport const agentJudge = (\n setup: AgentSetup,\n): Judge<\n AgentInput,\n FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner\n> => ({\n identity: { model: AGENT_MODEL, promptVersion: AGENT_PROMPT_VERSION },\n judge: (input) =>\n judgeIn(setup, input).pipe(\n Effect.scoped,\n Effect.timeout(AGENT_TIMEOUT),\n Effect.match({\n onSuccess: (verdict) => verdict,\n onFailure: (failure) => unknownBecause(reasonOf(failure)),\n }),\n ),\n});\n","import { judgeText } from \"@r_masseater/oxlint-plugin-decision\";\nimport { Effect } from \"effect\";\n\nimport { DECISION_MODEL, DECISION_TIMEOUT_MS } from \"#/shared/config/index.ts\";\n\nimport type { DecisionInput } from \"./judge-input.ts\";\nimport type { Judge } from \"./judge.ts\";\nimport { textOfLine, unknownBecause } from \"./verdict.ts\";\nimport type { Verdict } from \"./verdict.ts\";\n\nconst ANSWERED_YES = \"The decision model answered yes.\";\n\nconst judgeDecision = ({ rule, target: { text } }: DecisionInput): Effect.Effect<Verdict> =>\n Effect.sync((): Verdict => {\n const judged = judgeText({\n rule: { id: rule.id, question: rule.question, cutoff: rule.cutoff },\n text,\n model: DECISION_MODEL,\n timeoutMs: DECISION_TIMEOUT_MS,\n env: {},\n });\n if (judged.status === \"violation\") {\n return {\n status: \"violation\",\n line: judged.line,\n quote: textOfLine({ text, line: judged.line }),\n reason: ANSWERED_YES,\n };\n }\n if (judged.status === \"pass\") {\n return { status: \"pass\" };\n }\n return unknownBecause(judged.reason);\n });\n\n/** @internal */\nexport const DECISION_JUDGE: Judge<DecisionInput, never> = {\n identity: { model: DECISION_MODEL, promptVersion: 1 },\n judge: judgeDecision,\n};\n","import type { JudgeRule } from \"./judge-rule.ts\";\n\nconst DECISION_CUTOFF = 0.8;\n\n/** @internal */\nexport const JUDGE_RULES: readonly JudgeRule[] = [\n {\n kind: \"decision\",\n id: \"agents-no-task-record\",\n files: [\"**/AGENTS.md\"],\n question:\n \"Does this document record finished work, such as a changelog, a dated list of completed tasks or the history of what was changed and why, instead of rules and facts that stay true? Answer no for standing rules, commands and structure, even when a rule names a date or gives the reason it exists.\",\n message:\n \"Do not add a record of finished work to AGENTS.md. Put the reason for a change in its commit message.\",\n cutoff: DECISION_CUTOFF,\n },\n {\n kind: \"decision\",\n id: \"readme-no-code-restatement\",\n files: [\"**/README.md\"],\n question:\n \"Does this README list what the code already shows, such as every file, module, exported function, parameter, option or endpoint, instead of saying what the project is, how to start using it and where it is published? Answer no for a short table of entry points that a reader needs before opening the code, and for install and usage commands.\",\n message:\n \"Do not copy what the code shows into the README. Say what it is, how to start using it and where it is published, and leave parameters, options and file lists to the types and the code.\",\n cutoff: DECISION_CUTOFF,\n },\n {\n kind: \"agent\",\n id: \"skill-restates-skill\",\n files: [\"**/skills/*/SKILL.md\"],\n context: [\"../*/SKILL.md\", \"./**/*.md\"],\n question:\n \"Does this skill state a rule that another skill among the readable files also states in substance, so that two copies of one rule can drift apart? Answer no when the two rules differ in scope or reason, and when this skill only points to the other one.\",\n message:\n \"Keep each rule in one skill. Replace the copy with a pointer to the skill that owns the rule, or move the rule to where both can follow it.\",\n },\n];\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { JudgeInput } from \"./judge-input.ts\";\nimport type { JudgeIdentity } from \"./judge.ts\";\nimport { DecidedVerdictSchema, isDecided } from \"./verdict.ts\";\nimport type { Verdict } from \"./verdict.ts\";\n\nconst encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nconst decodeCached = Schema.decodeUnknownOption(Schema.fromJsonString(DecidedVerdictSchema));\n\nconst encodeCached = Schema.encodeEffect(Schema.fromJsonString(DecidedVerdictSchema));\n\nconst ruleKey = ({ rule }: JudgeInput): unknown => {\n if (rule.kind === \"decision\") {\n return { kind: rule.kind, id: rule.id, question: rule.question, cutoff: rule.cutoff };\n }\n return { kind: rule.kind, id: rule.id, question: rule.question, context: rule.context };\n};\n\n/** @internal */\nexport const cacheKeyOf = Effect.fn(\"cacheKeyOf\")(function* cacheKeyOf(\n input: JudgeInput,\n identity: JudgeIdentity,\n) {\n const files = yield* RepositoryFiles;\n const json = yield* encodeJson({\n ...identity,\n rule: ruleKey(input),\n target: input.target,\n context: pipe(\n input.context,\n Arr.map(({ name, text }) => [name, text]),\n ),\n }).pipe(Effect.orDie);\n return yield* files.hash(json);\n});\n\nconst fileOf = (directory: string, key: string): Effect.Effect<string, never, RepositoryFiles> =>\n RepositoryFiles.pipe(Effect.map((files) => files.join(directory, `${key}.json`)));\n\n/** @internal */\nexport const readCached = Effect.fn(\"readCached\")(function* readCached(\n directory: string,\n key: string,\n) {\n const files = yield* RepositoryFiles;\n const file = yield* fileOf(directory, key);\n const text = yield* files.readFile(file);\n return text.pipe(Option.flatMap(decodeCached));\n});\n\n/** @internal */\nexport const writeCached = Effect.fn(\"writeCached\")(function* writeCached(\n directory: string,\n { key, verdict }: { readonly key: string; readonly verdict: Verdict },\n) {\n if (!isDecided(verdict)) {\n return;\n }\n const files = yield* RepositoryFiles;\n const file = yield* fileOf(directory, key);\n const text = yield* encodeCached(verdict).pipe(Effect.orDie);\n yield* files.writeFile(file, text);\n});\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { AgentJudgeRule, DecisionJudgeRule, JudgeRule } from \"./judge-rule.ts\";\n\n/** @internal */\nexport interface JudgedFile {\n readonly name: string;\n readonly text: string;\n}\n\n/** @internal */\nexport interface JudgeInput<Rule extends JudgeRule = JudgeRule> {\n readonly rule: Rule;\n readonly target: JudgedFile;\n readonly context: readonly JudgedFile[];\n}\n\n/** @internal */\nexport type DecisionInput = JudgeInput<DecisionJudgeRule>;\n\n/** @internal */\nexport type AgentInput = JudgeInput<AgentJudgeRule>;\n\n/** @internal */\nexport const isDecisionInput = (input: JudgeInput): input is DecisionInput =>\n input.rule.kind === \"decision\";\n\n/** @internal */\nexport const isAgentInput = (input: JudgeInput): input is AgentInput => input.rule.kind === \"agent\";\n\n/** @internal */\nexport const readJudgedFile = Effect.fn(\"readJudgedFile\")(function* readJudgedFile(\n root: string,\n name: string,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, name));\n return text.pipe(Option.map((found): JudgedFile => ({ name, text: found })));\n});\n\n/** @internal */\nexport const readJudgedFiles = Effect.fn(\"readJudgedFiles\")(function* readJudgedFiles(\n root: string,\n names: readonly string[],\n) {\n const read = yield* Effect.forEach(names, (name) => readJudgedFile(root, name), {\n concurrency: \"unbounded\",\n });\n return pipe(read, Arr.getSomes);\n});\n","import { Array as Arr, Effect, Option, Order, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { readJudgedFile, readJudgedFiles } from \"./judge-input.ts\";\nimport type { JudgeInput } from \"./judge-input.ts\";\nimport type { JudgeRule } from \"./judge-rule.ts\";\n\nconst GLOB = \":(glob)\";\n\nconst globsOf = (patterns: readonly string[]): readonly string[] =>\n pipe(\n patterns,\n Arr.map((pattern) => `${GLOB}${pattern}`),\n );\n\nconst contextNames = Effect.fn(\"contextNames\")(function* contextNames(\n root: string,\n rule: JudgeRule,\n name: string,\n) {\n if (rule.kind === \"decision\") {\n return [];\n }\n const files = yield* RepositoryFiles;\n const directory = files.dirname(name);\n const listed = yield* Effect.forEach(\n rule.context,\n (pattern) => files.matchingFiles(root, globsOf([files.join(directory, pattern)])),\n { concurrency: \"unbounded\" },\n );\n return pipe(\n listed,\n Arr.flatten,\n Arr.filter((found) => found !== name),\n Arr.dedupe,\n (names) => Arr.sort(names, Order.String),\n );\n});\n\nconst inputOf = Effect.fn(\"inputOf\")(function* inputOf(\n root: string,\n { rule, name }: { readonly rule: JudgeRule; readonly name: string },\n) {\n const target = yield* readJudgedFile(root, name);\n if (Option.isNone(target)) {\n return Option.none<JudgeInput>();\n }\n const names = yield* contextNames(root, rule, name);\n const context = yield* readJudgedFiles(root, names);\n return Option.some<JudgeInput>({ rule, target: target.value, context });\n});\n\nconst inputsOf = Effect.fn(\"inputsOf\")(function* inputsOf(root: string, rule: JudgeRule) {\n const files = yield* RepositoryFiles;\n const names = yield* files.matchingFiles(root, globsOf(rule.files));\n const inputs = yield* Effect.forEach(names, (name) => inputOf(root, { rule, name }), {\n concurrency: \"unbounded\",\n });\n return Arr.getSomes(inputs);\n});\n\n/** @internal */\nexport const judgeInputs = Effect.fn(\"judgeInputs\")(function* judgeInputs(\n root: string,\n rules: readonly JudgeRule[],\n) {\n const perRule = yield* Effect.forEach(rules, (rule) => inputsOf(root, rule), {\n concurrency: \"unbounded\",\n });\n return Arr.flatten(perRule);\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { problemAtPosition, problemInFile } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { cacheKeyOf, readCached, writeCached } from \"./judge-cache.ts\";\nimport { isAgentInput, isDecisionInput } from \"./judge-input.ts\";\nimport type { AgentInput, DecisionInput, JudgeInput } from \"./judge-input.ts\";\nimport { judgeInputs } from \"./judge-pairs.ts\";\nimport type { JudgeRule } from \"./judge-rule.ts\";\nimport type { Judge } from \"./judge.ts\";\nimport type { Verdict } from \"./verdict.ts\";\n\nconst AGENT_CONCURRENCY = 4;\nconst SEQUENTIAL = 1;\nconst FIRST_COLUMN = 1;\nconst QUOTE_START = 0;\nconst QUOTE_LIMIT = 160;\nconst WHITESPACE = /\\s+/gu;\n\n/** @internal */\nexport interface JudgeSetup<Requirements> {\n readonly cacheDirectory: string;\n readonly rules: readonly JudgeRule[];\n readonly decision: Judge<DecisionInput, Requirements>;\n readonly agent: Judge<AgentInput, Requirements>;\n}\n\nconst oneLine = (text: string): string =>\n pipe(text, Str.replaceAll(WHITESPACE, \" \"), Str.trim, Str.slice(QUOTE_START, QUOTE_LIMIT));\n\nconst cachedBy =\n <Input extends JudgeInput, Requirements>(directory: string, judge: Judge<Input, Requirements>) =>\n (input: Input): Effect.Effect<Verdict, never, Requirements | RepositoryFiles> =>\n Effect.gen(function* cached() {\n const key = yield* cacheKeyOf(input, judge.identity);\n const hit = yield* readCached(directory, key);\n if (Option.isSome(hit)) {\n return hit.value;\n }\n const verdict = yield* judge.judge(input);\n yield* writeCached(directory, { key, verdict });\n return verdict;\n });\n\nconst problemOf = (\n file: string,\n { input, verdict }: { readonly input: JudgeInput; readonly verdict: Verdict },\n): Option.Option<Problem> => {\n const { rule } = input;\n if (verdict.status === \"pass\") {\n return Option.none();\n }\n if (verdict.status === \"unknown\") {\n return Option.some(\n problemInFile(\"judge-unknown\")(file, `Could not decide ${rule.id}. ${verdict.reason}`),\n );\n }\n return Option.some(\n problemAtPosition(rule.id)(\n file,\n { line: verdict.line, column: FIRST_COLUMN },\n `${rule.message} ${verdict.reason} Quoted: ${oneLine(verdict.quote)}`,\n ),\n );\n};\n\n/** @internal */\nexport const judgeRepository = Effect.fn(\"judgeRepository\")(function* judgeRepository<Requirements>(\n root: string,\n setup: JudgeSetup<Requirements>,\n) {\n const files = yield* RepositoryFiles;\n const inputs = yield* judgeInputs(root, setup.rules);\n const decisions = pipe(inputs, Arr.filter(isDecisionInput));\n const agents = pipe(inputs, Arr.filter(isAgentInput));\n const decided = yield* Effect.forEach(decisions, cachedBy(setup.cacheDirectory, setup.decision), {\n concurrency: SEQUENTIAL,\n });\n const reasoned = yield* Effect.forEach(agents, cachedBy(setup.cacheDirectory, setup.agent), {\n concurrency: AGENT_CONCURRENCY,\n });\n const answered: readonly JudgeInput[] = [...decisions, ...agents];\n return pipe(\n Arr.zip(answered, [...decided, ...reasoned]),\n Arr.map(([input, verdict]) =>\n problemOf(files.join(root, input.target.name), { input, verdict }),\n ),\n Arr.getSomes,\n );\n});\n","#!/usr/bin/env node\nimport { Array as Arr, Effect, Schema, Stdio, pipe } from \"effect\";\n\nimport { failWhenAny, writeJsonProblems, writeProblems } from \"#/app/output.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport {\n CLAUDE,\n DECISION_JUDGE,\n JUDGE_RULES,\n agentJudge,\n judgeRepository,\n} from \"#/features/judge-documents/index.ts\";\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { sortProblems } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass UsageError extends taggedError<UsageError, { readonly brand: unique symbol }>()(\n \"UsageError\",\n { message: Schema.String },\n) {}\n\nconst USAGE = `usage: msch-judge <cache directory> [${JSON_FLAG}]`;\n\nconst Arguments = Schema.Tuple([Schema.NonEmptyString]);\n\nconst cacheDirectoryOf = Effect.fn(\"cacheDirectoryOf\")(function* cacheDirectoryOf(\n args: readonly string[],\n) {\n const positional = pipe(\n args,\n Arr.filter((arg) => arg !== JSON_FLAG),\n );\n const [directory] = yield* Schema.decodeUnknownEffect(Arguments)(positional).pipe(\n Effect.mapError(() => UsageError.make({ message: USAGE })),\n );\n return directory;\n});\n\nconst report = Effect.fn(\"report\")(function* report(\n root: string,\n { problems, json }: { readonly problems: readonly Problem[]; readonly json: boolean },\n) {\n if (json) {\n return yield* writeJsonProblems(problems);\n }\n return yield* writeProblems(root)(problems);\n});\n\nconst judge = Effect.gen(function* judge() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const directory = yield* cacheDirectoryOf(args);\n const root = files.resolve(\".\");\n const found = yield* judgeRepository(root, {\n cacheDirectory: files.resolve(directory),\n rules: JUDGE_RULES,\n decision: DECISION_JUDGE,\n agent: agentJudge(CLAUDE),\n });\n const problems = sortProblems(found);\n yield* report(root, { problems, json: Arr.contains(args, JSON_FLAG) });\n return yield* failWhenAny(problems.length);\n});\n\nrunCli(\"msch-judge\")(judge);\n"],"mappings":";;;;;;;;;;;;AAKA,MAAa,cAAc,OAAO,OAAO;CACvC,SAAS,OAAO,SAAS;EAAC;EAAa;EAAQ;CAAS,CAAC;CACzD,OAAO,OAAO;CACd,QAAQ,OAAO;AACjB,CAAC;;AAGD,MAAa,eAAe,OAAO,qBAAqB,WAAW,CAAC,CAAC;AAKrE,MAAM,UAAU,UACd,KACE,OACAA,MAAI,KAAK,SAAS,KAAK,MAAM,GAC7BA,MAAI,KAAK,IAAI,CACf;AAEF,MAAM,iBAAiB,YACrB,KACE,SACAA,MAAI,KAAK,EAAE,WAAW,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AAW,MAAM;CAC1B,CAAC;CACD,MAAM,WAAW,aAAa,KAAK;CACnC,OAAO,OAAO,MAAM;EAAE;EAAU,MAAMA,MAAI,SAAS,MAAM,SAAS;CAAE,CAAC;CACrE,OAAO,OAAO,YAAY,SAAS,MAAM;AAC3C,CAAC;AAED,OAAO,YAAY,CAAC,CAAC,KAAK"}
|
package/dist/lint-rules.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as parent, c as toPosix, s as segments, t as baseName } from "./path-DUttmo2s.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { i as VIDEO_INTROS } from "./config-BBdsNPSO.mjs";
|
|
3
3
|
import { Array, Match, Option, Predicate, Record, Schema, String as String$1, pipe } from "effect";
|
|
4
4
|
import { isTypeNode } from "tsrs/ast/is";
|
|
5
5
|
import { SymbolFlags } from "tsrs/sync";
|
package/dist/lint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { c as INSTRUMENTATION, g as alchemyOverride, d as allRulesOf, _ as cloudflareResourceSyntax, v as commandsOverride, h as decisionPlugin, f as decisionRules, p as decisionTestRules, m as generated, u as lint, t as markdownOf, o as remotionRules, y as removalPolicyOverride, b as removalPolicySyntax, l as requiredStack, i as structureOf, n as textlintFilters, r as textlintPresets, s as tracedRules, a as videoRules } from "./define-lint-preset-
|
|
1
|
+
export { c as INSTRUMENTATION, g as alchemyOverride, d as allRulesOf, _ as cloudflareResourceSyntax, v as commandsOverride, h as decisionPlugin, f as decisionRules, p as decisionTestRules, m as generated, u as lint, t as markdownOf, o as remotionRules, y as removalPolicyOverride, b as removalPolicySyntax, l as requiredStack, i as structureOf, n as textlintFilters, r as textlintPresets, s as tracedRules, a as videoRules } from "./define-lint-preset-ALNtaoIc.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as JSON_FLAG } from "./cli-contract-D7btWrEu.mjs";
|
|
2
2
|
import { n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as writeStdout, t as ProblemsFound } from "./output-DYnV3b5B.mjs";
|
|
4
4
|
import { Array, Effect, Order, Schema, Stdio, pipe } from "effect";
|
|
5
5
|
// src/app/lookup-report.ts
|
|
6
6
|
const NONE_FOUND = 0;
|
|
@@ -26,4 +26,4 @@ const lookupReport = ({ row, rows, describe }) => Effect.gen(function* report()
|
|
|
26
26
|
});
|
|
27
27
|
export { lookupReport as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=lookup-report-
|
|
29
|
+
//# sourceMappingURL=lookup-report-VID9QVGU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-report-
|
|
1
|
+
{"version":3,"file":"lookup-report-VID9QVGU.mjs","names":["Arr"],"sources":["../src/app/lookup-report.ts"],"sourcesContent":["import { Array as Arr, Effect, Order, Schema, Stdio, pipe } from \"effect\";\n\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\n\nconst NONE_FOUND = 0;\nconst LINE_BREAK = \"\\n\";\n\nconst byPlace = Order.Struct({ file: Order.String, line: Order.Number });\n\n/** @internal */\nexport interface Place {\n readonly file: string;\n readonly line: number;\n}\n\n/** @internal */\nexport interface LookupReport<Row extends Place, Failure, Requirements> {\n readonly row: Schema.Codec<Row>;\n readonly rows: (root: string) => Effect.Effect<readonly Row[], Failure, Requirements>;\n readonly describe: (row: Row) => string;\n}\n\nconst textOf =\n <Row extends Place>(row: Schema.Codec<Row>, describe: (row: Row) => string) =>\n (json: boolean, rows: readonly Row[]): Effect.Effect<string, Schema.SchemaError> => {\n if (json) {\n return Schema.encodeEffect(row.pipe(Schema.Array, Schema.fromJsonString))(rows);\n }\n return Effect.succeed(\n pipe(\n rows,\n Arr.map((found) => `${describe(found)}${LINE_BREAK}`),\n Arr.join(\"\"),\n ),\n );\n };\n\n/** @internal */\nexport const lookupReport = <Row extends Place, Failure, Requirements>({\n row,\n rows,\n describe,\n}: LookupReport<Row, Failure, Requirements>): Effect.Effect<\n number,\n Failure | Schema.SchemaError | ProblemsFound,\n Requirements | RepositoryFiles | Stdio.Stdio\n> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const found = yield* rows(files.resolve(\".\"));\n const text = yield* textOf(row, describe)(\n Arr.contains(args, JSON_FLAG),\n Arr.sort(found, byPlace),\n );\n yield* writeStdout(text);\n if (found.length > NONE_FOUND) {\n return yield* ProblemsFound.make({ count: found.length });\n }\n return NONE_FOUND;\n });\n"],"mappings":";;;;;AAOA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAM,OAAO;CAAE,MAAM,MAAM;CAAQ,MAAM,MAAM;AAAO,CAAC;AAevE,MAAM,UACgB,KAAwB,cAC3C,MAAe,SAAoE;CAClF,IAAI,MACF,OAAO,OAAO,aAAa,IAAI,KAAK,OAAO,OAAO,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI;CAEhF,OAAO,OAAO,QACZ,KACE,MACAA,MAAI,KAAK,UAAU,GAAG,SAAS,KAAK,IAAI,YAAY,GACpDA,MAAI,KAAK,EAAE,CACb,CACF;AACF;;AAGF,MAAa,gBAA0D,EACrE,KACA,MACA,eAMA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,QAAQ,OAAO,KAAK,MAAM,QAAQ,GAAG,CAAC;CAC5C,MAAM,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CACvCA,MAAI,SAAS,MAAM,SAAS,GAC5BA,MAAI,KAAK,OAAO,OAAO,CACzB;CACA,OAAO,YAAY,IAAI;CACvB,IAAI,MAAM,SAAS,YACjB,OAAO,OAAO,cAAc,KAAK,EAAE,OAAO,MAAM,OAAO,CAAC;CAE1D,OAAO;AACT,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as formatProblem } from "./problem-OJg859cN.mjs";
|
|
1
|
+
import { r as formatProblem, t as ProblemList } from "./problem-OJg859cN.mjs";
|
|
2
2
|
import { n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
|
|
3
3
|
import { Array, Effect, Runtime, Schema, Stdio, Stream, pipe } from "effect";
|
|
4
4
|
// src/app/output.ts
|
|
@@ -19,10 +19,15 @@ const writeProblems = (root) => (problems) => Effect.gen(function* report() {
|
|
|
19
19
|
yield* writeStdout(pipe(problems, Array.map((problem) => `${format(problem)}\n`), Array.join("")));
|
|
20
20
|
});
|
|
21
21
|
/** @internal */
|
|
22
|
+
const writeJsonProblems = Effect.fn("writeJsonProblems")(function* writeJsonProblems(problems) {
|
|
23
|
+
const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);
|
|
24
|
+
return yield* writeStdout(text);
|
|
25
|
+
});
|
|
26
|
+
/** @internal */
|
|
22
27
|
const failWhenAny = (count) => {
|
|
23
28
|
if (count > NO_PROBLEMS) return Effect.fail(ProblemsFound.make({ count }));
|
|
24
29
|
return Effect.void;
|
|
25
30
|
};
|
|
26
|
-
export { writeStdout as i, failWhenAny as n,
|
|
31
|
+
export { writeStdout as a, writeProblems as i, failWhenAny as n, writeJsonProblems as r, ProblemsFound as t };
|
|
27
32
|
|
|
28
|
-
//# sourceMappingURL=output-
|
|
33
|
+
//# sourceMappingURL=output-DYnV3b5B.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-DYnV3b5B.mjs","names":["Arr"],"sources":["../src/app/output.ts"],"sourcesContent":["import { Array as Arr, Effect, Runtime, Schema, Stdio, Stream, pipe } from \"effect\";\n\nimport { ProblemList, formatProblem } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst taggedError = Schema.TaggedError;\nconst NO_PROBLEMS = 0;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {\n public override readonly [Runtime.errorReported] = false;\n}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n\n/** @internal */\nexport const writeProblems =\n (root: string) =>\n (problems: readonly Problem[]): Effect.Effect<void, never, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n });\n\n/** @internal */\nexport const writeJsonProblems = Effect.fn(\"writeJsonProblems\")(function* writeJsonProblems(\n problems: readonly Problem[],\n) {\n const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);\n return yield* writeStdout(text);\n});\n\n/** @internal */\nexport const failWhenAny = (count: number): Effect.Effect<void, ProblemsFound> => {\n if (count > NO_PROBLEMS) {\n return Effect.fail(ProblemsFound.make({ count }));\n }\n return Effect.void;\n};\n"],"mappings":";;;;AAMA,MAAM,cAAc,OAAO;AAC3B,MAAM,cAAc;AAEpB,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC;CACA,CAA0B,QAAQ,iBAAiB;AACrD;;AAGA,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC;;AAGD,MAAa,iBACV,UACA,aACC,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,eAAe,SAAS,MAAM,SAAS,MAAM,IAAI,CAAC;CACjE,OAAO,YACL,KACE,UACAA,MAAI,KAAK,YAAY,GAAG,OAAO,OAAO,EAAE,GAAG,GAC3CA,MAAI,KAAK,EAAE,CACb,CACF;AACF,CAAC;;AAGL,MAAa,oBAAoB,OAAO,GAAG,mBAAmB,CAAC,CAAC,UAAU,kBACxE,UACA;CACA,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ;CACpF,OAAO,OAAO,YAAY,IAAI;AAChC,CAAC;;AAGD,MAAa,eAAe,UAAsD;CAChF,IAAI,QAAQ,aACV,OAAO,OAAO,KAAK,cAAc,KAAK,EAAE,MAAM,CAAC,CAAC;CAElD,OAAO,OAAO;AAChB"}
|
package/dist/published.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-VID9QVGU.mjs";
|
|
3
3
|
import { t as runCli } from "./runtime-CFZ41rB0.mjs";
|
|
4
4
|
import { i as namedCatalogsOf, s as specifiedIn, t as fieldsOf } from "./specifiers-D9L0OV3r.mjs";
|
|
5
5
|
import { t as workspaceManifest } from "./workspace-manifest-CAVYfp66.mjs";
|
package/dist/refs.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-VID9QVGU.mjs";
|
|
3
3
|
import { t as runCli } from "./runtime-CFZ41rB0.mjs";
|
|
4
4
|
import { a as groupOf, n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
|
|
5
5
|
import { a as sent, i as publicLookup, n as githubToken, r as jsonLookup } from "./lookup-DjQU0W6q.mjs";
|
package/dist/unbumped.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { i as writeProblems, n as failWhenAny } from "./output-DYnV3b5B.mjs";
|
|
3
3
|
import { t as runCli } from "./runtime-CFZ41rB0.mjs";
|
|
4
4
|
import { t as checkPackageVersions } from "./package-versions-G9Unih6I.mjs";
|
|
5
5
|
import { s as sortProblems } from "./problem-OJg859cN.mjs";
|
package/dist/upstream.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-VID9QVGU.mjs";
|
|
3
3
|
import { t as runCli } from "./runtime-CFZ41rB0.mjs";
|
|
4
4
|
import { a as groupOf } from "./repository-files-C2gVviac.mjs";
|
|
5
5
|
import { n as githubToken, r as jsonLookup, t as fetched } from "./lookup-DjQU0W6q.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/msch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.1",
|
|
4
4
|
"description": "masseater's check policy: points every finite value set and object shape at its one owner, and ships the oxlint preset of plugins and rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"msch": "./dist/cli.mjs",
|
|
23
23
|
"msch-changed": "./dist/changed.mjs",
|
|
24
24
|
"msch-exits": "./dist/exits.mjs",
|
|
25
|
+
"msch-judge": "./dist/judge.mjs",
|
|
25
26
|
"msch-publish": "./dist/publish.mjs",
|
|
26
27
|
"msch-published": "./dist/published.mjs",
|
|
27
28
|
"msch-refs": "./dist/refs.mjs",
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
"@pnpm/workspace.workspace-manifest-writer": "^1100.2.13",
|
|
105
106
|
"@r_masseater/fu4": "^0.3.4",
|
|
106
107
|
"@r_masseater/kestrion": "^0.1.0",
|
|
107
|
-
"@r_masseater/oxlint-plugin-decision": "^0.
|
|
108
|
+
"@r_masseater/oxlint-plugin-decision": "^0.9.0",
|
|
108
109
|
"@r_masseater/oxlint-typed-rules": "^0.6.4",
|
|
109
110
|
"@r_masseater/textlint-rule-preset-ja": "^0.3.2",
|
|
110
111
|
"@r_masseater/wism": "^0.4.5",
|
|
@@ -11,6 +11,7 @@ sources:
|
|
|
11
11
|
- bin/msch.ts
|
|
12
12
|
- src/app/**
|
|
13
13
|
- bin/msch-exits.ts
|
|
14
|
+
- bin/msch-judge.ts
|
|
14
15
|
- bin/msch-unbumped.ts
|
|
15
16
|
- bin/msch-upstream.ts
|
|
16
17
|
---
|
|
@@ -39,6 +40,16 @@ Run `vp exec msch-exits` at the repository root to look the conditions up on npm
|
|
|
39
40
|
|
|
40
41
|
For a met condition, remove the entry and its patch file and run verify. If verify still needs the deviation, keep it and replace the condition with the next event that could end it.
|
|
41
42
|
|
|
43
|
+
## Judgment checks
|
|
44
|
+
|
|
45
|
+
A rule that no code can decide, such as a README that copies what the code shows or two skills that state the same rule, is judged by a model. `vp exec msch-judge <cache directory>` lists every pair of a rule and a file, skips the pairs whose verdict is cached, judges the rest and reports each violation as a finding. `--json` prints the findings as JSON. It exits with 1 when it finds a violation or cannot decide a pair.
|
|
46
|
+
|
|
47
|
+
Run it from a cloud session as a step of the daily audit, not in `verify`, a hook or CI, because a model does not answer the same way twice. The cache directory must live outside the repository, such as a folder of the project, so that nothing is committed and every repository shares one cache. The cache key holds the rule, the model, the prompt version, the target file and the context files, so a verdict changes only when one of them changes.
|
|
48
|
+
|
|
49
|
+
A rule that reads one file goes to the Cloudflare decision model and needs `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`. A rule that must read other files goes to `claude -p` in a temporary folder that holds only the target file and the declared context files, with read-only tools. It runs on the logged-in subscription, so no API key is needed. A violation must quote the offending text exactly. A verdict whose quote is not in the file is discarded as `judge-unknown`, as is a pair that could not be decided, and neither is cached, so the next run asks again.
|
|
50
|
+
|
|
51
|
+
To add a rule, add it to `JUDGE_RULES` in `libs/msch/src/features/judge-documents/model/judge-rules.ts` in masseater/ecosystems with its file globs, an English question that tells the model when to answer no, and a message that names the fix and its reason.
|
|
52
|
+
|
|
42
53
|
## Upstream of a reimplementation
|
|
43
54
|
|
|
44
55
|
A workspace that reimplements something records what it follows in the `upstream` field of its `package.json`, keyed by `npm:<package>`, `crate:<crate>` or `github:<owner>/<repo>`:
|
package/dist/config-C3jRfgJ9.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// src/shared/config/index.ts
|
|
2
|
-
const JAPANESE = /[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u;
|
|
3
|
-
/** @msch video.intro */
|
|
4
|
-
const VIDEO_INTROS = ["beats", "plain"];
|
|
5
|
-
export { VIDEO_INTROS as n, JAPANESE as t };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=config-C3jRfgJ9.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-C3jRfgJ9.mjs","names":[],"sources":["../src/shared/config/index.ts"],"sourcesContent":["export const JAPANESE = /[\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Han}]/u;\n\n/** @msch video.intro */\nexport const VIDEO_INTROS = [\"beats\", \"plain\"] as const;\n\nexport type VideoIntro = (typeof VIDEO_INTROS)[number];\n"],"mappings":";AAAA,MAAa,WAAW;;AAGxB,MAAa,eAAe,CAAC,SAAS,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-lint-preset-Cmdgaxwj.mjs","names":["Rec","Arr","Str","effectPresets","decisionPlugin","shadcn","Str","Arr","Rec"],"sources":["../src/features/define-lint-preset/config/lint-overrides.config.ts","../src/features/define-lint-preset/config/decision-rules.ts","../src/features/define-lint-preset/config/web-guidance.config.ts","../src/features/define-lint-preset/config/lint.config.ts","../src/features/define-lint-preset/config/test-rules.config.ts","../src/features/define-lint-preset/config/preset.ts","../src/features/define-lint-preset/config/required-stack.config.ts","../src/features/define-lint-preset/config/traced-rules.config.ts","../src/features/define-lint-preset/config/remotion-rules.config.ts","../src/features/define-lint-preset/config/video-rules.config.ts","../src/features/define-lint-preset/config/structure.config.ts","../src/features/define-lint-preset/config/kuromojin.config.ts","../src/features/define-lint-preset/config/textlint-presets.config.ts","../src/features/define-lint-preset/config/textlint-filters.config.ts","../src/features/define-lint-preset/config/markdown.config.ts"],"sourcesContent":["const LOGPUSH = 'Property[key.name=\"logpush\"]:not([value.value=false])';\nconst LOGPUSH_MESSAGE =\n \"Worker には logpush: true を付ける。付けないと、その Worker のログが Logpush に流れない\";\n\nconst CPU_LIMIT = 'Property[key.name=\"limits\"]:has(Property[key.name=\"cpuMs\"])';\nconst CPU_LIMIT_MESSAGE =\n \"コードを動かす Worker には limits.cpuMs を付け、本番の CPU 時間の最大値をわずかに上回る値にする。付けないと、1 回の暴走が上限の CPU 時間まで請求される\";\n\nconst UNATTRIBUTED_MODEL_CALL =\n \"モデルの呼び出しは AI Gateway を通し、呼び出し元を metadata に載せる。載せないと、費用やエラーを後から呼び出し元で引けない\";\n\nconst UNGATED_MODEL_CALL =\n \"モデルの呼び出しは AI Gateway を通す。通らない呼び出しには日ごとの費用の上限が掛からず、無料枠を超えた分がそのまま請求される\";\n\nconst MODEL_RUN =\n 'CallExpression[callee.property.name=\"run\"]:matches([callee.object.name=\"AI\"], [callee.object.property.name=\"AI\"])';\n\nconst AI_RUN_URL =\n \":matches(Literal[value=/ai.run/], TemplateLiteral:has(TemplateElement[value.raw=/ai.run/]))\";\n\nconst AI_RUN_REQUEST = `CallExpression:has(> ${AI_RUN_URL})`;\n\nexport const cloudflareResourceSyntax: readonly Readonly<{ selector: string; message: string }>[] =\n [\n {\n selector: `CallExpression[callee.object.name=\"Workers\"][callee.property.name=\"Worker\"] > ObjectExpression.arguments:not(:has(${LOGPUSH}))`,\n message: LOGPUSH_MESSAGE,\n },\n {\n selector: `CallExpression[callee.object.name=\"Website\"] > ObjectExpression.arguments:not(:has(${LOGPUSH}))`,\n message: LOGPUSH_MESSAGE,\n },\n {\n selector: `CallExpression[callee.object.name=/^(Workers|Website)$/] > ObjectExpression.arguments:has(Property[key.name=\"main\"]):not(:has(${CPU_LIMIT}))`,\n message: CPU_LIMIT_MESSAGE,\n },\n {\n selector: `CallExpression[callee.object.name=\"Website\"]:not([callee.property.name=\"StaticSite\"]) > ObjectExpression.arguments:not(:has(${CPU_LIMIT}))`,\n message: CPU_LIMIT_MESSAGE,\n },\n {\n selector: `${MODEL_RUN}[arguments.length<3]`,\n message: UNATTRIBUTED_MODEL_CALL,\n },\n {\n selector: `${MODEL_RUN} > .arguments:nth-child(3):not(Identifier[name=\"options\"])`,\n message: `${UNGATED_MODEL_CALL}。AI.run の第 3 引数には、runWorkersAi の call が受け取る options をそのまま渡す`,\n },\n {\n selector: `${AI_RUN_REQUEST} > ObjectExpression.arguments:not(:has(Property[key.name=\"headers\"]))`,\n message: `${UNGATED_MODEL_CALL}。REST の /ai/run を呼ぶときは、headers に cf-aig-gateway-id を付ける`,\n },\n {\n selector: `${AI_RUN_REQUEST} > ObjectExpression.arguments > Property[key.name=\"headers\"] > ObjectExpression:not(:has(Property[key.value=\"cf-aig-gateway-id\"]))`,\n message: `${UNGATED_MODEL_CALL}。REST の /ai/run を呼ぶときは、headers に cf-aig-gateway-id を付ける`,\n },\n {\n selector:\n 'CallExpression[callee.name=\"runWorkersAi\"] > ObjectExpression > Property[key.name=\"call\"] > ArrowFunctionExpression[params.length=0]',\n message: UNATTRIBUTED_MODEL_CALL,\n },\n {\n selector:\n 'CallExpression[callee.name=\"createAI\"] > ObjectExpression.arguments:not(:has(Property[key.name=\"metadata\"]))',\n message: UNATTRIBUTED_MODEL_CALL,\n },\n {\n selector:\n 'ObjectExpression:has(Property[key.value=\"cf-aig-gateway-id\"]):not(:has(Property[key.value=\"cf-aig-metadata\"]))',\n message: UNATTRIBUTED_MODEL_CALL,\n },\n {\n selector:\n 'CallExpression[callee.object.name=\"AI\"][callee.property.name=\"Gateway\"] > ObjectExpression.arguments:not(:has(Property[key.name=\"collectLogs\"][value.value=true]))',\n message:\n \"AI Gateway には collectLogs: true を付ける。付けないと、モデルの呼び出しが後から引けない\",\n },\n {\n selector:\n 'CallExpression[callee.object.name=\"AI\"][callee.property.name=\"Gateway\"] > ObjectExpression.arguments:not(:has(Property[key.name=\"spendLimits\"] > ObjectExpression > Property[key.name=\"enabled\"][value.value=true]))',\n message:\n \"AI Gateway には spendLimits を enabled: true で付け、日ごとの費用の上限を掛ける。付けないと、従量課金のモデルの呼び出しが上限なく請求される\",\n },\n {\n selector:\n 'CallExpression[callee.object.name=\"AI\"][callee.property.name=\"Gateway\"] > ObjectExpression.arguments:not(:has(Property[key.name=\"cacheTtl\"]))',\n message:\n \"AI Gateway には cacheTtl を付け、同じ問いの答えをキャッシュする。付けないと、同じ問いにも毎回課金される\",\n },\n {\n selector: 'MemberExpression[object.name=\"Rum\"][property.name=\"Site\"]',\n message:\n \"Rum.Site は使わない。CI のトークンに Account Settings Write が要る。Cloudflare API でホストごとに一度サイトを作り、トークンを CF_BEACON_TOKEN に置く\",\n },\n ];\nexport const removalPolicySyntax: Readonly<{ selector: string; message: string }> = {\n selector:\n 'CallExpression[callee.object.name=/^(D1|R2)$/][callee.property.name=/^(Database|Bucket)$/]:not(CallExpression[callee.property.name=\"pipe\"][arguments.0.callee.object.name=\"RemovalPolicy\"] > MemberExpression.callee > CallExpression.object)',\n message:\n \"D1 と R2 は作り直すと中身が消えるので、alchemy の RemovalPolicy.protect() を .pipe で付けて置き換えと削除を止める\",\n};\n\nexport const removalPolicyOverride: {\n files: string[];\n excludeFiles: string[];\n rules: Readonly<Record<string, [\"error\", ...unknown[]]>>;\n} = {\n files: [\"**/*.ts\"],\n excludeFiles: [\"**/*.test.ts\"],\n rules: {\n \"eslint-js/no-restricted-syntax\": [\"error\", ...cloudflareResourceSyntax, removalPolicySyntax],\n },\n};\n\nexport const alchemyOverride: {\n files: string[];\n rules: Readonly<Record<string, [\"error\", ...unknown[]]>>;\n} = {\n files: [\"**/alchemy.run.ts\"],\n rules: {\n \"eslint-js/no-restricted-syntax\": [\n \"error\",\n ...cloudflareResourceSyntax,\n removalPolicySyntax,\n {\n selector: 'CallExpression[callee.name=\"Stack\"]:not([arguments.0.name=\"APP_NAME\"])',\n message: \"スタック名には app-name.ts の APP_NAME を渡す\",\n },\n {\n selector:\n 'Program:not(:has(YieldExpression[delegate=true] > Identifier.argument[name=\"requireAppPrefix\"]))',\n message:\n \"スタックの最後で app-name.ts の requireAppPrefix を yield* して、リソース名の prefix を検査する\",\n },\n {\n selector:\n 'CallExpression[callee.name=\"Stack\"] > .arguments:nth-child(3):not(:has(FunctionExpression > BlockStatement > ExpressionStatement:nth-last-child(2) > YieldExpression[delegate=true] > Identifier.argument[name=\"requireAppPrefix\"]))',\n message:\n \"スタックの最後で app-name.ts の requireAppPrefix を yield* して、リソース名の prefix を検査する\",\n },\n ],\n },\n};\n\nexport const commandsOverride: {\n files: string[];\n rules: Readonly<Record<string, \"off\">>;\n} = {\n files: [\"bin/**\"],\n rules: {\n \"node/no-process-env\": \"off\",\n \"node/no-sync\": \"off\",\n \"effecttsgo/node-builtin-import\": \"off\",\n },\n};\n","import { createDecisionPlugin, defineDecisionRule } from \"@r_masseater/oxlint-plugin-decision\";\n\nexport default createDecisionPlugin({\n name: \"stack\",\n rules: [\n defineDecisionRule({\n id: \"exclusive-status\",\n target: \"file\",\n question:\n \"Does this code represent one piece of state with several boolean flags or optional fields whose combinations can contradict each other, instead of one exclusive status expressed as a discriminated union? Answer no when every state is a single exclusive status, or when the file holds no such state. A violation needs two or more booleans or optional fields that describe the same piece of state; a single boolean value, parameter, return value or field is not a violation, and a union of objects told apart by a status or kind field is already an exclusive status. A constant configuration object whose shape a library fixes, such as an OpenFeature flag definition, holds no state and is not a violation.\",\n message: \"状態は排他的なstatusを持つ判別共用体で表し、booleanフラグの組を使わない。\",\n cutoff: 0.8,\n }),\n defineDecisionRule({\n id: \"server-state-tanstack-query\",\n target: \"file\",\n question:\n \"Does this code fetch, cache or synchronize server data on the client with something other than TanStack Query, such as fetch inside useEffect, SWR or a hand-written cache? Answer no when server data on the client goes only through TanStack Query, or when the file handles none. Creating an API client such as a better-auth or Eden client, which fetches nothing until a query calls it, is not a violation.\",\n message: \"サーバー状態はTanStack Queryだけで扱う。\",\n cutoff: 0.8,\n }),\n defineDecisionRule({\n id: \"ui-state-effect-atom\",\n target: \"file\",\n question:\n \"Does this code hold client-side UI state with something other than effect-atom, such as useState, useReducer, React context used as a store, zustand, jotai or redux? Answer no when client-side UI state is held only by effect-atom, or when the file holds none. effect-atom is Atom from effect/reactivity, read and written through @effect/atom-react hooks such as useAtomValue and useAtomSet. Creating a TanStack Query QueryClient or configuring the router, which hold no UI state, is not a violation.\",\n message: \"UI状態はeffect-atomだけで扱う。\",\n cutoff: 0.8,\n }),\n ],\n});\n","import type { UserConfig } from \"vite-plus\";\n\ntype LintRules = NonNullable<NonNullable<UserConfig[\"lint\"]>[\"rules\"]>;\n\nexport const webGuidanceRules = {\n \"jsx-a11y/no-redundant-roles\": [\"error\", { ul: [\"list\"], ol: [\"list\"] }],\n \"jsx-a11y/no-noninteractive-tabindex\": [\"error\", { tags: [\"section\"], roles: [\"tabpanel\"] }],\n} satisfies LintRules;\n","import { presets as effectPresets } from \"@effect/tsgo/oxlint-presets\";\nimport htmlReact from \"@html-eslint/eslint-plugin-react\";\nimport eslintReact from \"@r_masseater/oxlint-typed-rules/react\";\nimport { Array as Arr, Record as Rec, String as Str, Struct, pipe } from \"effect\";\nimport reactHooks from \"eslint-plugin-react-hooks\";\n\nimport decisionPlugin from \"./decision-rules.ts\";\n\nexport const generated = [\n \"**/routeTree.gen.ts\",\n \"**/generated/**\",\n \"**/drizzle/**/snapshot.json\",\n \".claude/skills/**\",\n \".intent/**\",\n \"AGENTS.md\",\n \"CLAUDE.md\",\n \"**/CHANGELOG.md\",\n \".github/release-please/*manifest.json\",\n \"**/.release-please-manifest.json\",\n \"**/*.d.*.ts\",\n \"**/src-tauri/gen/**\",\n];\n\nconst asErrors = (names: readonly string[]): Readonly<Record<string, \"error\">> =>\n Rec.fromEntries(\n pipe(\n names,\n Arr.map((name) => [name, \"error\"] as const),\n ),\n );\n\nexport const allRulesOf = ({\n prefix,\n rules,\n}: Readonly<{ prefix: string; rules: Readonly<Record<string, unknown>> }>): Readonly<\n Record<string, \"error\">\n> =>\n asErrors(\n pipe(\n Rec.keys(rules),\n Arr.map((rule) => `${prefix}/${rule}`),\n ),\n );\n\nconst reactHooksRuleNames = pipe(\n Struct.keys(reactHooks.configs[\"recommended-latest\"].rules),\n Arr.map(Str.replace(\"react-hooks/\", \"react-hooks-js/\")),\n);\n\nconst reactHooksRules = asErrors(reactHooksRuleNames);\n\nconst eslintReactRuleNames = pipe(\n Rec.keys(eslintReact.configs[\"strict-typescript\"].rules ?? {}),\n Arr.filter(\n (name) => !(Str.replace(\"@eslint-react/\", \"react-hooks-js/\")(name) in reactHooksRules),\n ),\n);\n\nconst effectRuleNames = pipe(\n Rec.values(effectPresets),\n Arr.flatMap((preset) => Struct.keys(preset.rules ?? {})),\n);\n\nexport const pluginRules: Readonly<Record<string, \"error\">> = {\n ...asErrors(Rec.keys(htmlReact.configs.all.rules ?? {})),\n ...reactHooksRules,\n ...asErrors(eslintReactRuleNames),\n ...asErrors(effectRuleNames),\n};\n\nexport const decisionPluginName = decisionPlugin.meta.name;\n\nexport const decisionRules = allRulesOf({\n prefix: decisionPluginName,\n rules: decisionPlugin.rules,\n});\n\nexport const decisionTestRules = pipe(\n decisionRules,\n Rec.map(() => \"off\" as const),\n);\n\nexport const shadcnRestyleContracts = [\n { pattern: \"^Table(Head|Cell)$\", allow: [\"text-alignment\", \"fvn-spacing\"] },\n { pattern: \"^TableCaption$\", allow: [\"caption\", \"text-alignment\", \"mt-*\", \"mb-*\"] },\n];\n\nexport { webGuidanceRules } from \"./web-guidance.config.ts\";\n","import type { UserConfig } from \"vite-plus\";\n\ntype LintRules = NonNullable<NonNullable<UserConfig[\"lint\"]>[\"rules\"]>;\n\nconst NO_TEST_DOUBLES =\n \"依存の振る舞いを差し替えない。Effect の Layer を差し替えるか、本物の実装を使う\";\n\nexport const testRules = {\n \"vitest/expect-expect\": [\n \"error\",\n { assertFunctionNames: [\"expect\", \"expect*\", \"assert*\", \"waitFor*\", \"run\", \"*.run\"] },\n ],\n \"vitest/valid-expect\": [\"error\", { maxArgs: 2 }],\n \"vitest/valid-title\": [\"error\", { allowArguments: true }],\n \"vitest/prefer-called-times\": \"off\",\n \"vitest/prefer-import-in-mock\": \"off\",\n \"vitest/no-standalone-expect\": \"off\",\n \"vitest/no-conditional-in-test\": \"off\",\n \"vitest/require-test-timeout\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/require-top-level-describe\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/require-hook\": \"off\",\n \"vitest/no-hooks\": \"off\",\n \"vitest/consistent-test-it\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/padding-around-after-all-blocks\": \"off\",\n \"vitest/padding-around-test-blocks\": \"off\",\n \"vitest/max-expects\": \"off\",\n} satisfies LintRules;\n\nconst NO_FLAKE_MASKING =\n \"再試行や flakyTest で不安定なテストを隠さない。待つ対象のイベントを await して直す\";\n\nexport const testDoubleSyntax: readonly Readonly<{ selector: string; message: string }>[] = [\n {\n selector: 'CallExpression[callee.object.name=\"vi\"][callee.property.name=/^(mock|doMock)$/]',\n message: NO_TEST_DOUBLES,\n },\n {\n selector: 'CallExpression[callee.object.name=\"vi\"][callee.property.name=\"stubGlobal\"]',\n message: NO_TEST_DOUBLES,\n },\n];\n\nexport const flakeMaskingSyntax: readonly Readonly<{ selector: string; message: string }>[] = [\n { selector: 'Property[key.name=\"retry\"]', message: NO_FLAKE_MASKING },\n { selector: 'MemberExpression[property.name=\"retry\"]', message: NO_FLAKE_MASKING },\n { selector: 'MemberExpression[property.name=\"flakyTest\"]', message: NO_FLAKE_MASKING },\n];\n","import { fileURLToPath } from \"node:url\";\n\nimport tanstackQuery from \"@r_masseater/oxlint-typed-rules/tanstack-query\";\nimport tanstackRouter from \"@r_masseater/oxlint-typed-rules/tanstack-router\";\nimport { plugin as shadcn } from \"@shadcn/lint\";\nimport baselineJs from \"eslint-plugin-baseline-js\";\nimport type { UserConfig } from \"vite-plus\";\n\nimport {\n alchemyOverride,\n cloudflareResourceSyntax,\n removalPolicyOverride,\n commandsOverride,\n} from \"./lint-overrides.config.ts\";\nimport {\n allRulesOf,\n decisionPluginName,\n generated,\n pluginRules,\n shadcnRestyleContracts,\n webGuidanceRules,\n} from \"./lint.config.ts\";\nimport { flakeMaskingSyntax, testDoubleSyntax, testRules } from \"./test-rules.config.ts\";\n\ntype LintConfig = NonNullable<UserConfig[\"lint\"]>;\n\nconst resolved = (specifier: string): string => fileURLToPath(import.meta.resolve(specifier));\n\nconst DECISION_TIMEOUT_MS = 50_000;\n\nconst typedRules = \"@r_masseater/oxlint-typed-rules\";\n\nconst jsPlugins = [\n { name: \"vite-plus\", specifier: resolved(\"vite-plus/oxlint-plugin\") },\n { name: \"tanstack-query\", specifier: resolved(`${typedRules}/tanstack-query`) },\n { name: \"tanstack-router\", specifier: resolved(`${typedRules}/tanstack-router`) },\n { name: \"tanstack-start\", specifier: resolved(`${typedRules}/tanstack-start`) },\n { name: \"drizzle\", specifier: resolved(`${typedRules}/drizzle`) },\n { name: \"react-hooks-js\", specifier: resolved(\"eslint-plugin-react-hooks\") },\n { name: \"@eslint-react\", specifier: resolved(`${typedRules}/react`) },\n { name: \"@remotion\", specifier: resolved(`${typedRules}/remotion`) },\n { name: \"shadcn\", specifier: resolved(\"@shadcn/lint\") },\n { name: \"baseline-js\", specifier: resolved(\"eslint-plugin-baseline-js\") },\n { name: \"@html-eslint/react\", specifier: resolved(\"@html-eslint/eslint-plugin-react\") },\n { name: \"eslint-js\", specifier: resolved(\"oxlint-plugin-eslint\") },\n { name: decisionPluginName, specifier: resolved(\"@r_masseater/msch/decision-rules\") },\n { name: \"msch-lint\", specifier: resolved(\"@r_masseater/msch/lint-rules\") },\n];\n\nconst rules = {\n \"vite-plus/prefer-vite-plus-imports\": \"error\",\n \"tanstack-start/no-async-client-component\": \"error\",\n \"tanstack-start/no-client-code-in-server-component\": \"error\",\n ...allRulesOf({ prefix: \"tanstack-query\", rules: tanstackQuery.rules }),\n ...allRulesOf({ prefix: \"tanstack-router\", rules: tanstackRouter.rules }),\n \"drizzle/enforce-delete-with-where\": [\"error\", { drizzleObjectName: [\"db\"] }],\n \"drizzle/enforce-update-with-where\": [\"error\", { drizzleObjectName: [\"db\"] }],\n ...allRulesOf({ prefix: \"shadcn\", rules: shadcn.rules }),\n \"shadcn/no-restyle\": [\"error\", { contracts: shadcnRestyleContracts }],\n ...allRulesOf({ prefix: \"baseline-js\", rules: baselineJs.rules }),\n ...baselineJs.configs.recommended().rules,\n \"baseline-js/use-baseline\": [\n \"error\",\n {\n available: \"widely\",\n includeWebApis: { preset: \"auto\" },\n includeJsBuiltins: { preset: \"auto\" },\n },\n ],\n ...pluginRules,\n \"eslint/capitalized-comments\": \"off\",\n \"eslint/sort-imports\": \"off\",\n \"eslint/sort-keys\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/prefer-default-export\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/exports-last\": \"off\",\n ...testRules,\n ...webGuidanceRules,\n \"msch-lint/array-from-async\": \"error\",\n \"msch-lint/ecosystem-readers\": \"error\",\n \"msch-lint/explicit-import-path\": \"error\",\n \"msch-lint/get-or-insert\": \"error\",\n \"msch-lint/mcp-tool-layer\": \"error\",\n \"msch-lint/main-through-node-main\": \"error\",\n \"msch-lint/inline-exports\": \"error\",\n \"msch-lint/ui-state-in-atoms\": \"error\",\n \"msch-lint/no-hand-written-sql\": \"error\",\n \"msch-lint/platform-node-by-module\": \"error\",\n \"msch-lint/readonly-parameters\": \"error\",\n \"msch-lint/typed-calls-not-reflect\": \"error\",\n \"react/react-in-jsx-scope\": \"off\",\n \"eslint/no-undef\": \"off\",\n \"typescript/promise-function-async\": \"off\",\n \"react/forbid-component-props\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n \"node/no-top-level-await\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"eslint/new-cap\": [\"error\", { capIsNew: false }],\n \"eslint/one-var\": [\"error\", \"never\"],\n \"unicorn/relative-url-style\": [\"error\", \"always\"],\n \"eslint/id-length\": [\"error\", { exceptions: [\"x\", \"y\"] }],\n \"jsdoc/check-tag-names\": [\"error\", { definedTags: [\"msch\", \"stability\"] }],\n \"jsdoc/require-param\": [\"error\", { exemptedBy: [\"inheritdoc\", \"internal\", \"msch\", \"stability\"] }],\n \"jsdoc/require-returns\": [\n \"error\",\n { exemptedBy: [\"inheritdoc\", \"internal\", \"msch\", \"stability\"] },\n ],\n \"eslint-js/no-restricted-syntax\": [\"error\", ...cloudflareResourceSyntax],\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"eslint/no-duplicate-imports\": [\"error\", { allowSeparateTypeImports: true }],\n \"react/function-component-definition\": [\n \"error\",\n { namedComponents: \"arrow-function\", unnamedComponents: \"arrow-function\" },\n ],\n \"typescript/no-empty-interface\": [\"error\", { allowSingleExtends: true }],\n \"typescript/no-empty-object-type\": [\"error\", { allowInterfaces: \"with-single-extends\" }],\n \"react/jsx-filename-extension\": [\"error\", { extensions: [\".tsx\"] }],\n \"react/only-export-components\": [\"error\", { allowExportNames: [\"Route\"] }],\n} satisfies LintConfig[\"rules\"];\n\nconst overrides = [\n removalPolicyOverride,\n alchemyOverride,\n {\n files: [\"**/*.config.ts\", \"**/alchemy.*.ts\", \"**/decision-rules.ts\"],\n rules: { \"import/no-default-export\": \"off\" },\n },\n commandsOverride,\n {\n files: [\"**/bin/**\"],\n rules: { \"baseline-js/use-baseline\": \"off\" },\n },\n {\n files: [\"**/node-main/src/**\"],\n rules: { \"msch-lint/main-through-node-main\": \"off\" },\n },\n {\n files: [\"**/*.test.ts\", \"**/*.test.tsx\", \"**/*.test.support.ts\", \"**/vite.config.ts\"],\n rules: {\n \"eslint-js/no-restricted-syntax\": [\n \"error\",\n ...cloudflareResourceSyntax,\n ...flakeMaskingSyntax,\n ...testDoubleSyntax,\n ],\n },\n },\n {\n files: [\"**/vite.config.ts\"],\n rules: {\n \"eslint/max-lines\": \"off\",\n \"eslint/max-lines-per-function\": \"off\",\n \"baseline-js/use-baseline\": \"off\",\n },\n },\n] satisfies LintConfig[\"overrides\"];\n\nexport const lint = {\n ignorePatterns: generated,\n plugins: [\n \"eslint\",\n \"typescript\",\n \"unicorn\",\n \"oxc\",\n \"import\",\n \"react\",\n \"react-perf\",\n \"jsx-a11y\",\n \"jsdoc\",\n \"vitest\",\n \"promise\",\n \"node\",\n \"effecttsgo\",\n ],\n categories: {\n correctness: \"error\",\n suspicious: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n style: \"error\",\n restriction: \"error\",\n nursery: \"error\",\n },\n jsPlugins,\n rules,\n overrides,\n settings: {\n [decisionPluginName]: {\n model: \"cloudflare/@cf/cloudflare/clef-flash\",\n timeoutMs: DECISION_TIMEOUT_MS,\n ci: \"skip\",\n },\n },\n options: {\n typeAware: true,\n typeCheck: true,\n denyWarnings: true,\n reportUnusedDisableDirectives: \"error\",\n },\n} satisfies LintConfig;\n","const UI_STATE = \"UI 状態は effect-atom だけで扱う\";\n\nexport const INSTRUMENTATION = \"計装は Effect のトレーシングだけで扱う\";\nconst INFRASTRUCTURE = \"インフラは Alchemy の IaC と Cloudflare だけで扱い、wrangler は使わない\";\n\nexport const requiredStack: Readonly<Record<string, readonly string[]>> = {\n [UI_STATE]: [\n \"zustand\",\n \"jotai\",\n \"valtio\",\n \"recoil\",\n \"mobx\",\n \"mobx-*\",\n \"redux\",\n \"@reduxjs/*\",\n \"react-redux\",\n \"xstate\",\n \"@xstate/*\",\n \"nanostores\",\n \"@nanostores/*\",\n \"@preact/signals*\",\n ],\n \"サーバー状態は TanStack Query と Eden だけで扱う\": [\n \"swr\",\n \"react-query\",\n \"@apollo/*\",\n \"urql\",\n \"@urql/*\",\n \"axios\",\n \"ky\",\n \"ofetch\",\n \"got\",\n \"node-fetch\",\n \"graphql-request\",\n \"@trpc/*\",\n ],\n \"ルーティングとサーバーは TanStack Start と Elysia だけで扱う\": [\n \"react-router\",\n \"react-router-dom\",\n \"next\",\n \"@remix-run/*\",\n \"wouter\",\n \"express\",\n \"hono\",\n \"fastify\",\n \"koa\",\n \"@nestjs/*\",\n ],\n \"データベースは Drizzle だけで扱い、スキーマはマイグレーションで生成する\": [\n \"prisma\",\n \"@prisma/*\",\n \"typeorm\",\n \"sequelize\",\n \"kysely\",\n \"knex\",\n \"@mikro-orm/*\",\n \"better-sqlite3\",\n \"pg\",\n \"mysql2\",\n ],\n \"認証は better-auth だけで扱う\": [\n \"next-auth\",\n \"@auth/*\",\n \"lucia\",\n \"passport\",\n \"passport-*\",\n \"@clerk/*\",\n \"firebase/auth\",\n \"@supabase/*\",\n ],\n \"UI は shadcn/ui と Tailwind CSS だけで組む\": [\n \"@mui/*\",\n \"antd\",\n \"@chakra-ui/*\",\n \"@mantine/*\",\n \"styled-components\",\n \"@emotion/*\",\n \"bootstrap\",\n \"react-bootstrap\",\n ],\n \"検証、日時、ログ、関数型ユーティリティは Effect だけで扱う\": [\n \"zod\",\n \"yup\",\n \"joi\",\n \"valibot\",\n \"arktype\",\n \"io-ts\",\n \"superstruct\",\n \"moment\",\n \"dayjs\",\n \"date-fns\",\n \"luxon\",\n \"winston\",\n \"pino\",\n \"bunyan\",\n \"loglevel\",\n \"lodash\",\n \"lodash-es\",\n \"ramda\",\n \"rxjs\",\n \"fp-ts\",\n \"neverthrow\",\n \"ts-results\",\n \"purify-ts\",\n ],\n \"CSV は effect/encoding の Csv だけで読み書きする\": [\n \"papaparse\",\n \"csv-parse\",\n \"csv-parser\",\n \"csv-stringify\",\n \"fast-csv\",\n \"@fast-csv/*\",\n \"d3-dsv\",\n ],\n \"tar は effect/encoding の Tar だけで読み書きする\": [\n \"modern-tar\",\n \"nanotar\",\n \"tar\",\n \"tar-stream\",\n \"tar-fs\",\n \"tar-js\",\n \"tarts\",\n \"it-tar\",\n ],\n \"エージェントスキルは vite.config.ts の skills に書き、msch --prepare で入れる\": [\"skills\"],\n \"フィーチャーフラグは OpenFeature だけで扱う\": [\n \"launchdarkly-*\",\n \"@launchdarkly/*\",\n \"@growthbook/*\",\n \"unleash-client\",\n \"flagsmith\",\n \"@vercel/flags\",\n ],\n \"テストは Vitest と Playwright だけで扱う\": [\n \"jest\",\n \"jest-*\",\n \"@jest/*\",\n \"ts-jest\",\n \"mocha\",\n \"jasmine\",\n \"jasmine-core\",\n \"ava\",\n \"cypress\",\n \"tap\",\n \"uvu\",\n ],\n \"決済は Stripe だけで扱う\": [\n \"@paypal/*\",\n \"paypal-rest-sdk\",\n \"braintree\",\n \"@paddle/*\",\n \"@lemonsqueezy/*\",\n \"square\",\n ],\n \"整形は Vite+ の vp fmt だけで扱う\": [\n \"prettier\",\n \"prettier-plugin-*\",\n \"@prettier/*\",\n \"@biomejs/*\",\n \"dprint\",\n ],\n \"lint は Vite+ の vp lint だけで扱い、ESLint のプラグインは oxlint の JS プラグインとして読む\": [\n \"eslint\",\n \"@eslint/*\",\n \"eslint-config-*\",\n \"tslint\",\n \"standard\",\n \"xo\",\n ],\n [INSTRUMENTATION]: [\"@opentelemetry/*\", \"dd-trace\", \"newrelic\"],\n [INFRASTRUCTURE]: [\n \"wrangler\",\n \"miniflare\",\n \"@cloudflare/vite-plugin\",\n \"@vercel/*\",\n \"@netlify/*\",\n \"aws-cdk\",\n \"aws-cdk-lib\",\n \"@pulumi/*\",\n \"cdktf\",\n ],\n};\n","export const tracedRules = {\n \"msch-lint/traced-elysia\": \"error\",\n \"msch-lint/traced-effect-run\": \"error\",\n} as const;\n","import remotion from \"@r_masseater/oxlint-typed-rules/remotion\";\n\nimport { allRulesOf } from \"./lint.config.ts\";\n\nexport const remotionRules = allRulesOf({ prefix: \"@remotion\", rules: remotion.rules });\n","import type { VideoIntro } from \"#/shared/config/index.ts\";\n\nexport interface VideoSayOptions {\n readonly terms?: Readonly<Record<string, string>>;\n readonly banned?: Readonly<Record<string, string>>;\n readonly maxEmphasis?: number;\n}\n\nexport interface VideoSeriesOptions {\n readonly values?: Readonly<Record<string, string>>;\n readonly voices?: readonly string[];\n readonly opener?: string;\n readonly closer?: string;\n readonly intro?: VideoIntro;\n readonly afterIntro?: Readonly<Record<string, string>>;\n}\n\nexport interface VideoRulesOptions {\n readonly say: VideoSayOptions;\n readonly series: Readonly<Record<string, VideoSeriesOptions>>;\n readonly banned?: Readonly<Record<string, string>>;\n}\n\nexport const videoRules = ({ say, series, banned = {} }: VideoRulesOptions) =>\n ({\n \"msch-lint/video-say\": [\"error\", say],\n \"msch-lint/video-readings\": \"error\",\n \"msch-lint/video-series\": [\"error\", { series, banned }],\n }) as const;\n","import type { WismConfig } from \"@r_masseater/wism\";\nimport { rustCrate, skill, structure, workspace } from \"@r_masseater/wism/presets\";\nimport { Array as Arr, Predicate, String as Str, pipe } from \"effect\";\n\nconst NEGATION = \"!\";\nconst isIgnore = Predicate.not(Str.startsWith(NEGATION));\n\nexport interface StructureOptions {\n readonly members: readonly string[];\n readonly ignorePatterns: readonly string[];\n}\n\nexport const structureOf = ({ members, ignorePatterns }: StructureOptions): WismConfig =>\n structure({\n kinds: [workspace({ paths: members }), rustCrate(), skill()],\n ignores: pipe(ignorePatterns, Arr.filter(isIgnore)),\n });\n","import { createRequire, registerHooks } from \"node:module\";\n\nexport const KUROMOJIN = \"kuromojin\";\nconst ON_Y8 = \"@r_masseater/y8/kuromojin\";\n\nexport const requireWithY8Kuromojin = (parentUrl: string): NodeJS.Require => {\n registerHooks({\n resolve: (specifier, context, nextResolve) => {\n if (specifier === KUROMOJIN) {\n return nextResolve(ON_Y8, { ...context, parentURL: import.meta.url });\n }\n return nextResolve(specifier, context);\n },\n });\n return createRequire(parentUrl);\n};\n","import presetJa from \"@r_masseater/textlint-rule-preset-ja\";\nimport type { ToolSections } from \"@r_masseater/vite-plus-adopt\";\nimport { Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport { JAPANESE } from \"#/shared/config/index.ts\";\n\nimport { requireWithY8Kuromojin } from \"./kuromojin.config.ts\";\n\ntype Preset = NonNullable<NonNullable<ToolSections[\"textlint\"]>[\"presets\"]>[string];\ntype Rule = Preset[\"rules\"][string];\ntype Reporter = Extract<Rule, (...args: never) => unknown>;\ntype Fixable = Exclude<Rule, Reporter>;\n\nconst NO_HANDLERS = {};\n\nconst isPreset = (value: unknown): value is Preset =>\n Predicate.hasProperty(value, \"rules\") &&\n Predicate.isObject(value.rules) &&\n Predicate.hasProperty(value, \"rulesConfig\") &&\n Predicate.isObject(value.rulesConfig);\n\nconst presetIn = (value: unknown): Option.Option<Preset> => {\n if (isPreset(value)) {\n return Option.some(value);\n }\n if (Predicate.hasProperty(value, \"default\")) {\n return presetIn(value.default);\n }\n return Option.none();\n};\n\nconst required = requireWithY8Kuromojin(import.meta.url);\n\nconst presetOf = (specifier: string, loaded: unknown): Preset =>\n Option.getOrThrowWith(\n presetIn(loaded),\n () => new TypeError(`${specifier} does not export a textlint preset`),\n );\n\nconst japaneseOnly =\n (reporter: Reporter): Reporter =>\n (context, options) => {\n if (JAPANESE.test(context.getSource())) {\n return reporter(context, options);\n }\n return NO_HANDLERS;\n };\n\nconst forJapanese = (rule: Reporter | Readonly<Fixable>): Rule => {\n if (Predicate.isFunction(rule)) {\n return japaneseOnly(rule);\n }\n return { linter: japaneseOnly(rule.linter), fixer: japaneseOnly(rule.fixer) };\n};\n\nconst japanesePreset = (specifier: string, loaded: unknown): Preset => {\n const { rules, rulesConfig } = presetOf(specifier, loaded);\n return { rules: pipe(rules, Rec.map(forJapanese)), rulesConfig };\n};\n\nexport const textlintPresets: NonNullable<NonNullable<ToolSections[\"textlint\"]>[\"presets\"]> = {\n \"@r_masseater/preset-ja\": japanesePreset(\"@r_masseater/textlint-rule-preset-ja\", presetJa),\n \"@textlint-ja/preset-ai-writing\": japanesePreset(\n \"@textlint-ja/textlint-rule-preset-ai-writing\",\n required(\"@textlint-ja/textlint-rule-preset-ai-writing\"),\n ),\n \"preset-ja-technical-writing\": japanesePreset(\n \"textlint-rule-preset-ja-technical-writing\",\n required(\"textlint-rule-preset-ja-technical-writing\"),\n ),\n};\n","import { createRequire } from \"node:module\";\n\nimport type { ToolSections } from \"@r_masseater/vite-plus-adopt\";\nimport { Option, Predicate, pipe } from \"effect\";\n\ntype Filter = NonNullable<NonNullable<ToolSections[\"textlint\"]>[\"filterModules\"]>[string];\n\nconst isFilter = (value: unknown): value is Filter => Predicate.isFunction(value);\n\nconst filterIn = (specifier: string, loaded: unknown): Filter =>\n pipe(\n Option.liftPredicate(loaded, isFilter),\n Option.getOrThrowWith(() => new TypeError(`${specifier} does not export a textlint filter`)),\n );\n\nexport const textlintFilters: NonNullable<NonNullable<ToolSections[\"textlint\"]>[\"filterModules\"]> =\n {\n comments: filterIn(\n \"textlint-filter-rule-comments\",\n createRequire(import.meta.url)(\"textlint-filter-rule-comments\"),\n ),\n };\n","import type { RuleEntry, Y8Config } from \"@r_masseater/y8\";\nimport { recommended } from \"@r_masseater/y8/presets\";\nimport type { RecommendedOptions } from \"@r_masseater/y8/presets\";\n\nconst INDEX_SKILL = \"masseater-style\";\n\nconst MASSEATER_DOCS: RecommendedOptions = {\n agents: {\n sections: [[\"Tech stack\"], [\"Commands\"], [\"Rules\"]],\n commands: [\"Commands\"],\n stack: [\"Tech stack\"],\n skillNames: { index: INDEX_SKILL },\n },\n skills: { skillNames: { index: INDEX_SKILL } },\n};\n\nconst MARKDOWN_IGNORES = [\n \".agents/skills/**\",\n \"**/fixtures/**\",\n \"**/upstream/**\",\n \"CHANGELOG.md\",\n \"**/CLAUDE.md\",\n];\n\nexport interface MarkdownOptions {\n readonly ignores?: readonly string[];\n readonly rules?: Readonly<Record<string, RuleEntry>>;\n readonly docs?: RecommendedOptions;\n}\n\nexport const markdownOf = ({ ignores = [], rules = {}, docs = {} }: MarkdownOptions): Y8Config => ({\n extends: [\n recommended({\n ...MASSEATER_DOCS,\n ...docs,\n agents: { ...MASSEATER_DOCS.agents, ...docs.agents },\n skills: { ...MASSEATER_DOCS.skills, ...docs.skills },\n }),\n ],\n rules: { \"agnix/XP-001\": \"off\", ...rules },\n reportUnusedDirectives: true,\n ignores: [...MARKDOWN_IGNORES, ...ignores],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,MAAM,UAAU;AAChB,MAAM,kBACJ;AAEF,MAAM,YAAY;AAClB,MAAM,oBACJ;AAEF,MAAM,0BACJ;AAEF,MAAM,qBACJ;AAEF,MAAM,YACJ;AAKF,MAAM,iBAAiB;AAEvB,MAAa,2BACX;CACE;EACE,UAAU,qHAAqH,QAAQ;EACvI,SAAS;CACX;CACA;EACE,UAAU,sFAAsF,QAAQ;EACxG,SAAS;CACX;CACA;EACE,UAAU,iIAAiI,UAAU;EACrJ,SAAS;CACX;CACA;EACE,UAAU,+HAA+H,UAAU;EACnJ,SAAS;CACX;CACA;EACE,UAAU,GAAG,UAAU;EACvB,SAAS;CACX;CACA;EACE,UAAU,GAAG,UAAU;EACvB,SAAS,GAAG,mBAAmB;CACjC;CACA;EACE,UAAU,GAAG,eAAe;EAC5B,SAAS,GAAG,mBAAmB;CACjC;CACA;EACE,UAAU,GAAG,eAAe;EAC5B,SAAS,GAAG,mBAAmB;CACjC;CACA;EACE,UACE;EACF,SAAS;CACX;CACA;EACE,UACE;EACF,SAAS;CACX;CACA;EACE,UACE;EACF,SAAS;CACX;CACA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;EACA;GACE,OAAO;IAAC;IAAkB;IAAmB;GAAsB;GACnE,OAAO,EAAE,4BAA4B,MAAM;EAC7C;EACA;EACA;GACE,OAAO,CAAC,WAAW;GACnB,OAAO,EAAE,4BAA4B,MAAM;EAC7C;EACA;GACE,OAAO,CAAC,qBAAqB;GAC7B,OAAO,EAAE,oCAAoC,MAAM;EACrD;EACA;GACE,OAAO;IAAC;IAAgB;IAAiB;IAAwB;GAAmB;GACpF,OAAO,EACL,kCAAkC;IAChC;IACA,GAAG;IACH,GAAG;IACH,GAAG;GACL,EACF;EACF;EACA;GACE,OAAO,CAAC,mBAAmB;GAC3B,OAAO;IACL,oBAAoB;IACpB,iCAAiC;IACjC,4BAA4B;GAC9B;EACF;CA+BA;CACA,UAAU,GACP,qBAAqB;EACpB,OAAO;EACP,WAAW;EACX,IAAI;CACN,EACF;CACA,SAAS;EACP,WAAW;EACX,WAAW;EACX,cAAc;EACd,+BAA+B;CACjC;AACF;;ACxMA,MAAM,WAAW;AAEjB,MAAa,kBAAkB;AAC/B,MAAM,iBAAiB;AAEvB,MAAa,gBAA6D;EACvE,WAAW;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,uCAAuC;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,8CAA8C;EAC5C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,4CAA4C;EAC1C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,yBAAyB;EACvB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,uCAAuC;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,qCAAqC;EACnC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,yCA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,WACnC,KACE,OAAO,cAAc,QAAQ,QAAQ,GACrC,OAAO,qCAAqB,IAAI,UAAU,GAAG,UAAU,mCAAmC,CAAC,CAC7F;AAEF,MAAa,kBACX,EACE,UAAU,SACR,iCACA,cAAc,YAAY,GAAG,CAAC,CAAC,+BAA+B,CAChE,EACF;;ACjBF,MAAM,cAAc;AAEpB,MAAM,iBAAqC;CACzC,QAAQ;EACN,UAAU;GAAC,CAAC,YAAY;GAAG,CAAC,UAAU;GAAG,CAAC,OAAO;EAAC;EAClD,UAAU,CAAC,UAAU;EACrB,OAAO,CAAC,YAAY;EACpB,YAAY,EAAE,OAAO,YAAY;CACnC;CACA,QAAQ,EAAE,YAAY,EAAE,OAAO,YAAY,EAAE;AAC/C;AAEA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;AACF;AAQA,MAAa,cAAc,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,SAAoC;CACjG,SAAS,CACP,YAAY;EACV,GAAG;EACH,GAAG;EACH,QAAQ;GAAE,GAAG,eAAe;GAAQ,GAAG,KAAK;EAAO;EACnD,QAAQ;GAAE,GAAG,eAAe;GAAQ,GAAG,KAAK;EAAO;CACrD,CAAC,CACH;CACA,OAAO;EAAE,gBAAgB;EAAO,GAAG;CAAM;CACzC,wBAAwB;CACxB,SAAS,CAAC,GAAG,kBAAkB,GAAG,OAAO;AAC3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-BUCq_3DP.mjs","names":["Arr"],"sources":["../src/app/output.ts"],"sourcesContent":["import { Array as Arr, Effect, Runtime, Schema, Stdio, Stream, pipe } from \"effect\";\n\nimport { formatProblem } from \"#/shared/lib/problem.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst taggedError = Schema.TaggedError;\nconst NO_PROBLEMS = 0;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {\n public override readonly [Runtime.errorReported] = false;\n}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n\n/** @internal */\nexport const writeProblems =\n (root: string) =>\n (problems: readonly Problem[]): Effect.Effect<void, never, RepositoryFiles | Stdio.Stdio> =>\n Effect.gen(function* report() {\n const files = yield* RepositoryFiles;\n const format = formatProblem((file) => files.relative(root, file));\n yield* writeStdout(\n pipe(\n problems,\n Arr.map((problem) => `${format(problem)}\\n`),\n Arr.join(\"\"),\n ),\n );\n });\n\n/** @internal */\nexport const failWhenAny = (count: number): Effect.Effect<void, ProblemsFound> => {\n if (count > NO_PROBLEMS) {\n return Effect.fail(ProblemsFound.make({ count }));\n }\n return Effect.void;\n};\n"],"mappings":";;;;AAMA,MAAM,cAAc,OAAO;AAC3B,MAAM,cAAc;AAEpB,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC;CACA,CAA0B,QAAQ,iBAAiB;AACrD;;AAGA,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC;;AAGD,MAAa,iBACV,UACA,aACC,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,eAAe,SAAS,MAAM,SAAS,MAAM,IAAI,CAAC;CACjE,OAAO,YACL,KACE,UACAA,MAAI,KAAK,YAAY,GAAG,OAAO,OAAO,EAAE,GAAG,GAC3CA,MAAI,KAAK,EAAE,CACb,CACF;AACF,CAAC;;AAGL,MAAa,eAAe,UAAsD;CAChF,IAAI,QAAQ,aACV,OAAO,OAAO,KAAK,cAAc,KAAK,EAAE,MAAM,CAAC,CAAC;CAElD,OAAO,OAAO;AAChB"}
|