@r_masseater/msch 0.129.4 → 0.131.0
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/dist/cli.mjs +1204 -494
- package/dist/cli.mjs.map +1 -1
- package/dist/config-B3SYjao5.mjs.map +1 -1
- package/dist/config.d.mts +2 -4
- package/dist/config.mjs +538 -1
- package/dist/config.mjs.map +1 -0
- package/dist/{index-B15MNLWU.d.mts → index-C93QRE06.d.mts} +4 -2
- package/dist/repository-text-Dy8EkFIh.mjs +350 -0
- package/dist/repository-text-Dy8EkFIh.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +2 -2
- package/package.json +5 -3
- package/skills/msch-checks/SKILL.md +1 -1
- package/skills/msch-publishing/SKILL.md +1 -1
- package/skills/msch-repository-config/SKILL.md +8 -4
- package/skills/msch-workspace-settings/SKILL.md +1 -1
- package/dist/repository-config-Dq5OIwyx.mjs +0 -869
- package/dist/repository-config-Dq5OIwyx.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["Arr","MESSAGE","Arr","MESSAGE","MESSAGE","SEPARATOR","FILTER_KEYS","QUOTED","Arr","Str","SEPARATOR","Arr","Str","MESSAGE","Arr","Arr","Str","MESSAGE","Arr","Str","Arr","Rec","Arr","Rec","preset","Arr"],"sources":["../src/features/guard-workflows/model/yaml.ts","../src/features/guard-workflows/model/publish-trigger.ts","../src/features/guard-workflows/model/release-please.ts","../src/features/guard-workflows/model/workflow-commit.ts","../src/features/guard-workflows/model/repository-services.ts","../src/features/guard-workflows/model/workflow-references.ts","../src/features/guard-workflows/model/workflow-package.ts","../src/features/guard-workflows/model/workflow-path-filter.ts","../src/features/guard-workflows/model/workflow-path.ts","../src/features/guard-workflows/model/workflow-queue.ts","../src/features/guard-workflows/model/workflow-script.ts","../src/features/guard-workflows/model/policy.ts","../src/features/guard-workflows/model/fu4-config.ts","../src/app/repository-commit.ts","../src/app/repository-dependencies.ts","../src/app/repository-config.ts"],"sourcesContent":["import type { RuleContext, YamlNode } from \"@r_masseater/fu4\";\nimport { pairsOf, valueAt } from \"@r_masseater/fu4/rules\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nexport interface Located {\n readonly text: string;\n readonly line: number;\n readonly column: number;\n}\n\nexport const rootOf = ({ source }: RuleContext): Option.Option<YamlNode> =>\n Option.fromNullishOr(source.yaml);\n\nexport const stringOf = (node: Option.Option<YamlNode>): Option.Option<Located> =>\n pipe(\n node,\n Option.filter(({ kind }) => kind === \"scalar\"),\n Option.map(({ value, line, column }) => ({ text: value, line, column })),\n );\n\nexport const childOf =\n (key: string) =>\n (node: Option.Option<YamlNode>): Option.Option<YamlNode> =>\n pipe(node, Option.flatMap(valueAt(key)));\n\nexport const keyNodeOf =\n (key: string) =>\n (node: Option.Option<YamlNode>): Option.Option<YamlNode> =>\n pipe(\n node,\n Option.flatMap((mapping) =>\n pipe(\n pairsOf(mapping),\n Arr.findFirst((pair) => pair.key.value === key),\n Option.map((pair) => pair.key),\n ),\n ),\n );\n\nexport const itemsOf = (node: Option.Option<YamlNode>): readonly YamlNode[] =>\n pipe(\n node,\n Option.filter(({ kind }) => kind === \"sequence\"),\n Option.map(({ children }) => children),\n Option.getOrElse((): readonly YamlNode[] => []),\n );\n\nexport const entriesOf = (\n node: Option.Option<YamlNode>,\n): readonly (readonly [string, YamlNode])[] =>\n pipe(\n node,\n Option.map(pairsOf),\n Option.getOrElse(() => []),\n Arr.map((pair) => [pair.key.value, pair.value] as const),\n );\n\nexport const scalarsIn = (node: YamlNode): readonly Located[] => {\n if (node.kind === \"scalar\") {\n return [{ text: node.value, line: node.line, column: node.column }];\n }\n return pipe(\n node.children,\n Arr.flatMap((child) => scalarsIn(child)),\n );\n};\n\nconst ownValuesNamed = (name: string, node: YamlNode): readonly YamlNode[] => {\n if (node.kind !== \"mapping\") {\n return [];\n }\n return pipe(\n pairsOf(node),\n Arr.filter((pair) => pair.key.value === name),\n Arr.map((pair) => pair.value),\n );\n};\n\nexport const valuesNamed =\n (name: string) =>\n (node: YamlNode): readonly YamlNode[] => [\n ...ownValuesNamed(name, node),\n ...pipe(node.children, Arr.flatMap(valuesNamed(name))),\n ];\n\nexport const descend =\n (...keys: readonly string[]) =>\n (node: Option.Option<YamlNode>): Option.Option<YamlNode> => {\n let found = node;\n for (const key of keys) {\n found = pipe(found, childOf(key));\n }\n return found;\n };\n","import type { YamlNode } from \"@r_masseater/fu4\";\nimport { NOOP, keysOf, runOf, workflowRule } from \"@r_masseater/fu4/rules\";\nimport type { Visitor } from \"@r_masseater/fu4/rules\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { childOf, keyNodeOf, rootOf } from \"./yaml.ts\";\n\nconst PUBLISH = /\\bmsch\\s+publish\\s+(?:plan|npm|release)\\b/u;\nconst MANUAL = \"workflow_dispatch\";\nconst TRIGGER_KEY = \"on\";\nconst MESSAGE =\n \"publishes with `msch publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch publish dispatch`.\";\n\nconst triggersOf = (node: YamlNode): readonly string[] => {\n if (node.kind === \"scalar\") {\n return [node.value];\n }\n if (node.kind === \"sequence\") {\n return pipe(\n node.children,\n Arr.map(({ value }) => value),\n );\n }\n return keysOf(node);\n};\n\n/** @internal */\nexport const publishTrigger = workflowRule({\n description:\n \"Reports msch publish steps in a workflow that something other than workflow_dispatch starts\",\n visitor: (fail, context): Visitor => {\n const publishing: string[] = [];\n return {\n ...NOOP,\n step: (step): void => {\n const publishes = pipe(\n runOf(step),\n Option.flatMap(({ run }) => Option.fromNullishOr(run)),\n Option.exists(({ value }) => PUBLISH.test(value)),\n );\n if (publishes) {\n publishing.push(MANUAL);\n }\n },\n workflowPost: (): void => {\n const root = rootOf(context);\n const triggers = pipe(\n childOf(TRIGGER_KEY)(root),\n Option.map(triggersOf),\n Option.getOrElse((): readonly string[] => []),\n );\n const manualOnly = pipe(\n triggers,\n Arr.every((trigger) => trigger === MANUAL),\n );\n if (Arr.isReadonlyArrayNonEmpty(publishing) && !manualOnly) {\n for (const key of pipe(root, keyNodeOf(TRIGGER_KEY), Option.toArray)) {\n fail(key, MESSAGE);\n }\n }\n },\n };\n },\n});\n","import { NOOP, actionOf, workflowRule } from \"@r_masseater/fu4/rules\";\nimport type { Visitor } from \"@r_masseater/fu4/rules\";\nimport { Option, pipe } from \"effect\";\n\nconst RELEASE_PLEASE = /^googleapis\\/release-please-action(?:@|$)/u;\nconst MESSAGE =\n \"releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch publish` for the workspace.\";\n\n/** @internal */\nexport const releasePlease = workflowRule({\n description: \"Reports the release-please action, because releases here are manual\",\n visitor: (fail): Visitor => ({\n ...NOOP,\n step: (step): void => {\n const uses = pipe(\n actionOf(step),\n Option.flatMap(({ uses: text }) => Option.fromNullishOr(text)),\n Option.filter(({ value }) => RELEASE_PLEASE.test(value)),\n Option.toArray,\n );\n for (const found of uses) {\n fail(found, MESSAGE);\n }\n },\n }),\n});\n","import { NOOP, actionOf, runOf, workflowRule } from \"@r_masseater/fu4/rules\";\nimport type { Visitor } from \"@r_masseater/fu4/rules\";\nimport { Option, pipe } from \"effect\";\n\nconst GIT_WRITE = /\\bgit\\s+(?:-{1,2}\\S+\\s+(?:\\S+\\s+)?)*(?:commit|push)\\b/u;\nconst COMMIT_ACTION = /^[^@/]+\\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;\nconst MESSAGE =\n \"commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.\";\n\n/** @internal */\nexport const workflowCommit = workflowRule({\n description: \"Reports git commit, git push and commit actions in a workflow\",\n visitor: (fail): Visitor => ({\n ...NOOP,\n step: (step): void => {\n const writes = pipe(\n runOf(step),\n Option.flatMap((exec) => {\n const position = Option.orElse(Option.fromNullishOr(exec.runPosition), () =>\n Option.fromNullishOr(exec.run),\n );\n return Option.fromNullishOr(exec.run).pipe(\n Option.filter(({ value }) => GIT_WRITE.test(value)),\n Option.zipRight(position),\n );\n }),\n );\n const commits = pipe(\n actionOf(step),\n Option.flatMap(({ uses }) => Option.fromNullishOr(uses)),\n Option.filter(({ value }) => COMMIT_ACTION.test(value)),\n );\n const flagged = writes.pipe(\n Option.orElse(() => commits),\n Option.toArray,\n );\n for (const found of flagged) {\n fail(found, MESSAGE);\n }\n },\n }),\n});\n","import { Effect, Layer, ManagedRuntime } from \"effect\";\n\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\nimport { nodeRepositoryFiles, nodeServicesLayer } from \"#/shared/lib/repository-files.ts\";\n\nconst runtime = nodeRepositoryFiles.pipe(Layer.provide(nodeServicesLayer), ManagedRuntime.make);\n\n/** @internal */\nexport const inRepository = <Found>(\n effect: Effect.Effect<Found, never, RepositoryFiles>,\n): Effect.Effect<Found> => Effect.promise(() => runtime.runPromise(effect));\n","import type { YamlNode } from \"@r_masseater/fu4\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { childOf, descend, entriesOf, itemsOf, scalarsIn, stringOf } from \"./yaml.ts\";\nimport type { Located } from \"./yaml.ts\";\n\nconst ROOT = \".\";\nconst LOCAL = \"./\";\nconst NEGATION = \"!\";\nconst SEPARATOR = \"/\";\nconst LINE = \"\\n\";\nconst UNRESOLVED_MARKERS = [\"${{\", \"$\", \"{\"];\nconst ABSOLUTE_MARKERS = [\"/\", \"~\"];\nconst FILE_INPUT_SUFFIX = \"-file\";\nconst DEPENDENCY_PATH_INPUT = \"cache-dependency-path\";\nconst FILTER_KEYS = [\"paths\", \"paths-ignore\"];\nconst HASH_FILES = /hashFiles\\((?<arguments>[^)]*)\\)/gu;\nconst QUOTED = /'(?<path>[^']*)'/gu;\nconst SCRIPT = /^[\\w.@/-]+\\.(?:ts|mts|cts|sh)$/u;\nconst TOKEN_SEPARATOR = /[\\s;&|()<>\"'`=]+/u;\n\nexport const ACTION_DEFINITIONS: readonly string[] = [\"action.yml\", \"action.yaml\"];\n\nexport type ReferenceKind = \"glob\" | \"file\" | \"script\" | \"directory\" | \"action\";\n\nexport interface WorkflowReference extends Located {\n readonly kind: ReferenceKind;\n readonly field: string;\n readonly path: string;\n}\n\ntype Entry = readonly [string, YamlNode];\n\nconst containsAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.includes(marker)(path)),\n );\n\nconst startsWithAny =\n (markers: readonly string[]) =>\n (path: string): boolean =>\n pipe(\n markers,\n Arr.some((marker) => Str.startsWith(marker)(path)),\n );\n\nconst isLiteralPath = (path: string): boolean =>\n Str.isNonEmpty(path) &&\n !containsAny(UNRESOLVED_MARKERS)(path) &&\n !startsWithAny(ABSOLUTE_MARKERS)(path);\n\nconst withoutLocal = (path: string): string => {\n if (Str.startsWith(LOCAL)(path)) {\n return Str.slice(LOCAL.length)(path);\n }\n return path;\n};\n\nconst joinPath = (base: string, path: string): string => {\n const relative = withoutLocal(Str.trim(path));\n if (base === ROOT) {\n return relative;\n }\n return `${base}${SEPARATOR}${relative}`;\n};\n\nconst reference =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n ({ text, line, column }: Located): readonly WorkflowReference[] => {\n const path = Str.trim(text);\n if (!isLiteralPath(path) || !isLiteralPath(base)) {\n return [];\n }\n return [{ kind, field, path: joinPath(base, path), text, line, column }];\n };\n\nconst isPositive = ({ text }: Located): boolean => !Str.startsWith(NEGATION)(Str.trim(text));\n\nconst globsIn = (field: string, node: Option.Option<YamlNode>): readonly WorkflowReference[] =>\n pipe(\n itemsOf(node),\n Arr.flatMap((item) => pipe(item, Option.some, stringOf, Option.toArray)),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", field)),\n );\n\nconst filtersOf = ([event, filters]: Entry): readonly WorkflowReference[] =>\n pipe(\n FILTER_KEYS,\n Arr.flatMap((key) => globsIn(`on.${event}.${key}`, pipe(filters, Option.some, childOf(key)))),\n );\n\nconst workingDirectoryOf = (owner: Option.Option<YamlNode>): Option.Option<Located> =>\n pipe(owner, descend(\"defaults\", \"run\", \"working-directory\"), stringOf);\n\nconst directoryOf = (found: Option.Option<Located>, base: string): string =>\n pipe(\n found,\n Option.map(({ text }) => joinPath(ROOT, text)),\n Option.getOrElse(() => base),\n );\n\nconst located =\n (kind: ReferenceKind, field: string, base = ROOT) =>\n (found: Option.Option<Located>): readonly WorkflowReference[] =>\n pipe(found, Option.toArray, Arr.flatMap(reference(kind, field, base)));\n\nconst localUses = (node: Option.Option<YamlNode>): Option.Option<Located> =>\n pipe(\n node,\n childOf(\"uses\"),\n stringOf,\n Option.filter(({ text }) => Str.startsWith(LOCAL)(text)),\n );\n\nconst scriptsIn =\n (field: string, base: string) =>\n ({ text, line, column }: Located): readonly WorkflowReference[] =>\n pipe(\n Str.split(text, TOKEN_SEPARATOR),\n Arr.filter((token) => SCRIPT.test(token)),\n Arr.dedupe,\n Arr.flatMap((token) => pipe({ text: token, line, column }, reference(\"script\", field, base))),\n );\n\nconst isFileInput = ([key]: Entry): boolean =>\n Str.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;\n\nconst linesOf = ({ text, line, column }: Located): readonly Located[] =>\n pipe(\n Str.split(text, LINE),\n Arr.map((each) => ({ text: each, line, column })),\n );\n\nconst fileInputOf =\n (field: string) =>\n ([key, value]: Entry): readonly WorkflowReference[] =>\n pipe(\n value,\n Option.some,\n stringOf,\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.flatMap(reference(\"glob\", `${field}.with.${key}`)),\n );\n\nconst fileInputsIn = (field: string, step: YamlNode): readonly WorkflowReference[] =>\n pipe(\n step,\n Option.some,\n childOf(\"with\"),\n entriesOf,\n Arr.filter(isFileInput),\n Arr.flatMap(fileInputOf(field)),\n );\n\nconst scriptReferencesOf = (\n field: string,\n directory: string,\n step: YamlNode,\n): readonly WorkflowReference[] =>\n pipe(\n step,\n Option.some,\n childOf(\"run\"),\n stringOf,\n Option.toArray,\n Arr.flatMap(scriptsIn(`${field}.run`, directory)),\n );\n\nconst stepReferences =\n (job: string, base: string) =>\n (step: YamlNode, index: number): readonly WorkflowReference[] => {\n const field = `jobs.${job}.steps[${index}]`;\n const own = pipe(step, Option.some, childOf(\"working-directory\"), stringOf);\n const directory = directoryOf(own, base);\n return [\n ...pipe(step, Option.some, localUses, located(\"action\", `${field}.uses`)),\n ...pipe(own, located(\"directory\", `${field}.working-directory`)),\n ...scriptReferencesOf(field, directory, step),\n ...fileInputsIn(field, step),\n ];\n };\n\nconst jobReferences =\n (base: string) =>\n ([job, node]: Entry): readonly WorkflowReference[] => {\n const own = pipe(node, Option.some, workingDirectoryOf);\n const steps = pipe(node, Option.some, childOf(\"steps\"), itemsOf);\n const directory = directoryOf(own, base);\n return [\n ...pipe(node, Option.some, localUses, located(\"file\", `jobs.${job}.uses`)),\n ...pipe(own, located(\"directory\", `jobs.${job}.defaults.run.working-directory`)),\n ...pipe(steps, Arr.flatMap(stepReferences(job, directory))),\n ];\n };\n\nconst groupsOf =\n (pattern: RegExp, group: string) =>\n ({ text, line, column }: Located): readonly Located[] =>\n pipe(\n Arr.fromIterable(Str.matchAll(pattern)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[group])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, line, column })),\n );\n\nconst hashFilesIn = (root: YamlNode): readonly WorkflowReference[] =>\n pipe(\n scalarsIn(root),\n Arr.flatMap(groupsOf(HASH_FILES, \"arguments\")),\n Arr.flatMap(groupsOf(QUOTED, \"path\")),\n Arr.filter(isPositive),\n Arr.flatMap(reference(\"glob\", \"hashFiles\")),\n );\n\nconst jobsOf = (root: YamlNode): readonly Entry[] =>\n pipe(root, Option.some, childOf(\"jobs\"), entriesOf);\n\n/** @internal */\nexport const workflowReferences = (root: YamlNode): readonly WorkflowReference[] => {\n const workflowDefault = pipe(root, Option.some, workingDirectoryOf);\n const base = directoryOf(workflowDefault, ROOT);\n return [\n ...pipe(root, Option.some, childOf(\"on\"), entriesOf, Arr.flatMap(filtersOf)),\n ...pipe(workflowDefault, located(\"directory\", \"defaults.run.working-directory\")),\n ...pipe(jobsOf(root), Arr.flatMap(jobReferences(base))),\n ...hashFilesIn(root),\n ];\n};\n\nconst outputPathsOf = (step: YamlNode): readonly string[] =>\n pipe(\n step,\n Option.some,\n descend(\"with\", \"path\"),\n stringOf,\n Option.toArray,\n Arr.flatMap(linesOf),\n Arr.map(({ text }) => joinPath(ROOT, text)),\n Arr.filter(isLiteralPath),\n );\n\n/** @internal */\nexport const producedPaths = (root: YamlNode): readonly string[] =>\n pipe(\n jobsOf(root),\n Arr.flatMap(([, job]) => pipe(job, Option.some, childOf(\"steps\"), itemsOf)),\n Arr.flatMap(outputPathsOf),\n );\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { defineRule } from \"@r_masseater/fu4\";\nimport type { Report, YamlNode } from \"@r_masseater/fu4\";\nimport { pairsOf } from \"@r_masseater/fu4/rules\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { namedWorkspaces, patternOf } from \"#/entities/workspace/index.ts\";\nimport type { NamedWorkspace } from \"#/entities/workspace/index.ts\";\n\nimport { inRepository } from \"./repository-services.ts\";\nimport { workflowReferences } from \"./workflow-references.ts\";\nimport { childOf, scalarsIn, stringOf } from \"./yaml.ts\";\nimport type { Located } from \"./yaml.ts\";\n\nconst WORKFLOW = /(?:^|\\/)\\.github\\/workflows\\/(?<name>[^/]+)\\.ya?ml$/u;\nconst ACTION = /(?:^|\\/)\\.github\\/actions\\/(?<name>[^/]+)\\/action\\.ya?ml$/u;\nconst PACKAGE_FILTER =\n /(?:^|\\s)(?:--filter|-F)(?:\\s+|=)(?<quote>[\"']?)(?<value>[^\\s\"'$][^\\s\"']*)\\k<quote>/gu;\nconst SEPARATOR = \"/\";\nconst WORD_SEPARATORS = /[-_]/gu;\nconst SPACE = \" \";\nconst FIRST_LINE: Located = { text: \"\", line: 1, column: 1 };\n\nconst packageMessage = (what: string, directory: string): string =>\n `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;\n\nconst matching = (workspaces: readonly NamedWorkspace[], text: string): Option.Option<string> =>\n pipe(\n workspaces,\n Arr.findFirst(\n ({ names }) =>\n Arr.isReadonlyArrayNonEmpty(names) && Option.isSome(Str.match(patternOf(names))(text)),\n ),\n Option.map(({ directory }) => directory),\n );\n\nconst named = (workspaces: readonly NamedWorkspace[], text: string): Option.Option<string> =>\n Option.orElse(matching(workspaces, text), () =>\n matching(workspaces, Str.replaceAll(WORD_SEPARATORS, SPACE)(text)),\n );\n\nconst containing = (workspaces: readonly NamedWorkspace[], path: string): Option.Option<string> =>\n pipe(\n workspaces,\n Arr.findFirst(\n ({ directory }) => path === directory || Str.startsWith(`${directory}${SEPARATOR}`)(path),\n ),\n Option.map(({ directory }) => directory),\n );\n\nconst filtersIn = (scalars: readonly Located[]): readonly Located[] =>\n pipe(\n scalars,\n Arr.flatMap(({ text, line, column }) =>\n pipe(\n Arr.fromIterable(Str.matchAll(PACKAGE_FILTER)(text)),\n Arr.flatMap((match) =>\n pipe(\n Option.fromNullishOr(match.groups),\n Option.flatMap((groups) => Option.fromNullishOr(groups[\"value\"])),\n Option.toArray,\n ),\n ),\n Arr.map((value) => ({ text: value, line, column })),\n ),\n ),\n );\n\nconst findingFor = (\n what: string,\n found: Located,\n directory: Option.Option<string>,\n): readonly Finding[] =>\n pipe(\n directory,\n Option.map((workspace): Finding => ({\n line: found.line,\n column: found.column,\n message: packageMessage(what, workspace),\n })),\n Option.toArray,\n );\n\ntype Finding = Pick<Report, \"line\" | \"column\" | \"message\">;\n\nconst namesIn = (stem: string, root: Option.Option<YamlNode>): readonly Located[] => [\n { ...FIRST_LINE, text: stem },\n ...pipe(root, childOf(\"name\"), stringOf, Option.toArray),\n ...pipe(\n root,\n childOf(\"jobs\"),\n Option.map((jobs) =>\n pipe(\n pairsOf(jobs),\n Arr.map(({ key }): Located => ({ text: key.value, line: key.line, column: key.column })),\n ),\n ),\n Option.getOrElse((): readonly Located[] => []),\n ),\n];\n\nconst workflowFindings = (\n workspaces: readonly NamedWorkspace[],\n stem: string,\n root: YamlNode,\n): readonly Finding[] => {\n const fromNames = pipe(\n namesIn(stem, Option.some(root)),\n Arr.flatMap((found) => findingFor(`\"${found.text}\"`, found, named(workspaces, found.text))),\n );\n const referenced = pipe(\n workflowReferences(root),\n Arr.filter(({ field }) => !Str.startsWith(\"on.\")(field)),\n Arr.flatMap((found) => findingFor(found.field, found, containing(workspaces, found.path))),\n );\n const filtered = pipe(\n filtersIn(scalarsIn(root)),\n Arr.flatMap((found) =>\n findingFor(`--filter ${found.text}`, found, matching(workspaces, found.text)),\n ),\n );\n return [...fromNames, ...referenced, ...filtered];\n};\n\nexport const workflowPackage = defineRule({\n meta: {\n description: \"Reports workflows, jobs, actions and paths that are made for one workspace\",\n kinds: [\"workflow\", \"action\"],\n },\n check: ({ filename, project, source, report }) =>\n Effect.gen(function* checkPackages() {\n const workspaces = yield* namedWorkspaces(project.root);\n const asWorkflow = groupOf(\"name\")(WORKFLOW.exec(filename));\n const asAction = groupOf(\"name\")(ACTION.exec(filename));\n const found: readonly Finding[] = [\n ...pipe(\n asAction,\n Option.flatMap((name) => named(workspaces, name)),\n Option.map((directory): Finding => ({\n ...FIRST_LINE,\n message: packageMessage(\n `The action ${Option.getOrElse(asAction, () => \"\")}`,\n directory,\n ),\n })),\n Option.toArray,\n ),\n ...pipe(\n Option.all([asWorkflow, Option.fromNullishOr(source.yaml)]),\n Option.map(([stem, root]) => workflowFindings(workspaces, stem, root)),\n Option.getOrElse((): readonly Finding[] => []),\n ),\n ];\n for (const each of found) {\n report(each);\n }\n }).pipe(inRepository),\n});\n","import { defineRule } from \"@r_masseater/fu4\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { childOf, entriesOf, keyNodeOf, rootOf, scalarsIn } from \"./yaml.ts\";\n\nconst FILTER_KEYS: readonly string[] = [\"paths\", \"paths-ignore\"];\nconst PATHS_FILTER_ACTION = /(?:^|\\/)paths-filter@/u;\nconst MESSAGE =\n \"A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.\";\n\n/** @internal */\nexport const workflowPathFilter = defineRule({\n meta: {\n description: \"Reports paths and paths-ignore triggers and the paths-filter action\",\n kinds: [\"workflow\"],\n },\n check: (context): void => {\n const root = rootOf(context);\n const triggers = pipe(\n root,\n childOf(\"on\"),\n entriesOf,\n Arr.flatMap(([, trigger]) =>\n pipe(\n FILTER_KEYS,\n Arr.flatMap((key) => pipe(Option.some(trigger), keyNodeOf(key), Option.toArray)),\n ),\n ),\n );\n const actions = pipe(\n Option.toArray(root),\n Arr.flatMap((node) => scalarsIn(node)),\n Arr.filter(({ text }) => PATHS_FILTER_ACTION.test(text)),\n );\n for (const found of [...triggers, ...actions]) {\n context.report({ line: found.line, column: found.column, message: MESSAGE });\n }\n },\n});\n","import { defineRule } from \"@r_masseater/fu4\";\nimport { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { existsAt, isDirectoryAt, isIgnored, staticPrefix } from \"#/shared/lib/path-existence.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { inRepository } from \"./repository-services.ts\";\nimport { ACTION_DEFINITIONS, producedPaths, workflowReferences } from \"./workflow-references.ts\";\nimport type { ReferenceKind, WorkflowReference } from \"./workflow-references.ts\";\n\nconst SEPARATOR = \"/\";\n\nconst EXPECTED: Readonly<Record<ReferenceKind, string>> = {\n action: \"a directory with action.yml\",\n directory: \"a directory\",\n file: \"a file\",\n glob: \"a pattern that matches a tracked file\",\n script: \"a file\",\n};\n\ntype Resolver = (root: string, path: string) => Effect.Effect<boolean, never, RepositoryFiles>;\n\nconst matchesAny = Effect.fn(\"matchesAny\")(function* matchesAny(\n root: string,\n pathspecs: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const matched = yield* files.matchingFiles(root, pathspecs);\n return Arr.isReadonlyArrayNonEmpty(matched);\n});\n\nconst matchesGlob: Resolver = (root, path) => matchesAny(root, [`:(glob)${path}`]);\n\nconst hasAction: Resolver = Effect.fn(\"hasAction\")(function* hasAction(root: string, path: string) {\n const found = yield* Effect.forEach(\n ACTION_DEFINITIONS,\n (name) => existsAt(root, `${path}${SEPARATOR}${name}`),\n { concurrency: 1 },\n );\n return pipe(found, Arr.some(Boolean));\n});\n\nconst suffixAt =\n (segments: readonly string[]) =>\n (index: number): string =>\n `:(glob)**/${pipe(segments, Arr.drop(index), Arr.join(SEPARATOR))}`;\n\nconst findsScript: Resolver = Effect.fn(\"findsScript\")(function* findsScript(\n root: string,\n path: string,\n) {\n if (yield* existsAt(root, path)) {\n return true;\n }\n const segments = Str.split(path, SEPARATOR);\n return yield* matchesAny(root, Arr.makeBy(segments.length, suffixAt(segments)));\n});\n\nconst RESOLVERS: Readonly<Record<ReferenceKind, Resolver>> = {\n action: hasAction,\n directory: isDirectoryAt,\n file: existsAt,\n glob: matchesGlob,\n script: findsScript,\n};\n\nconst overlaps =\n (path: string) =>\n (produced: string): boolean =>\n produced === path ||\n Str.startsWith(`${path}${SEPARATOR}`)(produced) ||\n Str.startsWith(`${produced}${SEPARATOR}`)(path);\n\nconst isMissing = Effect.fn(\"isMissing\")(function* isMissing(\n root: string,\n produced: readonly string[],\n found: WorkflowReference,\n) {\n const prefix = staticPrefix(found.path);\n if (pipe(produced, Arr.some(overlaps(prefix)))) {\n return false;\n }\n if (yield* RESOLVERS[found.kind](root, found.path)) {\n return false;\n }\n return !(yield* isIgnored(root, found.path));\n});\n\nexport const workflowPath = defineRule({\n meta: {\n description: \"Reports a path that a workflow names and the repository does not have\",\n kinds: [\"workflow\"],\n },\n check: ({ project, source, report }) =>\n Effect.gen(function* checkPaths() {\n for (const yaml of Option.toArray(Option.fromNullishOr(source.yaml))) {\n const produced = producedPaths(yaml);\n const missing = yield* Effect.filter(workflowReferences(yaml), (found) =>\n isMissing(project.root, produced, found),\n );\n for (const found of missing) {\n report({\n line: found.line,\n column: found.column,\n message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`,\n });\n }\n }\n }).pipe(inRepository),\n});\n","import { defineRule } from \"@r_masseater/fu4\";\nimport { keysOf } from \"@r_masseater/fu4/rules\";\nimport { Array as Arr, Option, pipe } from \"effect\";\n\nimport { keyNodeOf, rootOf, valuesNamed } from \"./yaml.ts\";\n\nconst CONCURRENCY_KEY = \"concurrency\";\nconst QUEUE_KEY = \"queue\";\nconst MESSAGE =\n \"queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.\";\n\n/** @internal */\nexport const workflowQueue = defineRule({\n meta: {\n description:\n \"Reports queue on a concurrency group, because a queued group holds back the newest commit\",\n kinds: [\"workflow\"],\n },\n check: (context): void => {\n const keys = pipe(\n rootOf(context),\n Option.toArray,\n Arr.flatMap((root) => valuesNamed(CONCURRENCY_KEY)(root)),\n Arr.filter((group) => Arr.contains(keysOf(group), QUEUE_KEY)),\n Arr.flatMap((group) => pipe(Option.some(group), keyNodeOf(QUEUE_KEY), Option.toArray)),\n );\n for (const key of keys) {\n context.report({ line: key.line, column: key.column, message: MESSAGE });\n }\n },\n});\n","import { NOOP, runOf, workflowRule } from \"@r_masseater/fu4/rules\";\nimport type { Visitor } from \"@r_masseater/fu4/rules\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nconst COMMAND_CHAIN = /&&|\\|\\||;|\\|/u;\nconst QUOTED = /\\$\\{\\{.*?\\}\\}|\"(?:[^\"\\\\]|\\\\.)*\"|'[^']*'/gu;\nconst COMMENT = \"#\";\nconst ONE_COMMAND = 1;\nconst MESSAGE =\n \"runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.\";\n\nconst isCommand = (line: string): boolean => Str.isNonEmpty(line) && !Str.startsWith(COMMENT)(line);\n\nconst chainsCommands = (line: string): boolean =>\n COMMAND_CHAIN.test(Str.replaceAll(QUOTED, \"\")(line));\n\nconst runsMoreThanOneCommand = (text: string): boolean => {\n const lines = pipe(Str.split(\"\\n\")(text), Arr.map(Str.trim), Arr.filter(isCommand));\n return lines.length > ONE_COMMAND || pipe(lines, Arr.some(chainsCommands));\n};\n\n/** @internal */\nexport const workflowScript = workflowRule({\n description: \"Reports a run step with more than one command, because the logic belongs in a task\",\n visitor: (fail): Visitor => ({\n ...NOOP,\n step: (step): void => {\n const runs = pipe(\n runOf(step),\n Option.flatMap(({ run }) => Option.fromNullishOr(run)),\n Option.filter(({ value }) => runsMoreThanOneCommand(value)),\n Option.toArray,\n );\n for (const found of runs) {\n fail(found, MESSAGE);\n }\n },\n }),\n});\n","import { definePlugin } from \"@r_masseater/fu4\";\nimport type { Fu4Config } from \"@r_masseater/fu4\";\nimport { Array as Arr, Record as Rec, pipe } from \"effect\";\n\nimport { publishTrigger } from \"./publish-trigger.ts\";\nimport { releasePlease } from \"./release-please.ts\";\nimport { workflowCommit } from \"./workflow-commit.ts\";\nimport { workflowPackage } from \"./workflow-package.ts\";\nimport { workflowPathFilter } from \"./workflow-path-filter.ts\";\nimport { workflowPath } from \"./workflow-path.ts\";\nimport { workflowQueue } from \"./workflow-queue.ts\";\nimport { workflowScript } from \"./workflow-script.ts\";\n\nconst NAME = \"msch\";\n\nconst plugin = definePlugin({\n rules: {\n \"publish-trigger\": publishTrigger,\n \"release-please\": releasePlease,\n \"workflow-commit\": workflowCommit,\n \"workflow-package\": workflowPackage,\n \"workflow-path\": workflowPath,\n \"workflow-path-filter\": workflowPathFilter,\n \"workflow-queue\": workflowQueue,\n \"workflow-script\": workflowScript,\n },\n});\n\n/** @internal */\nexport const workflowPolicy = (): Fu4Config => ({\n plugins: Rec.singleton(NAME, plugin),\n rules: pipe(\n Rec.keys(plugin.rules),\n Arr.map((rule): readonly [string, \"error\"] => [`${NAME}/${rule}`, \"error\"]),\n Rec.fromEntries,\n ),\n});\n","import type { Fu4Config } from \"@r_masseater/fu4\";\nimport { recommended } from \"@r_masseater/fu4/presets\";\n\nimport { workflowPolicy } from \"./policy.ts\";\n\n/** @internal */\nexport const fu4Of = (): Fu4Config => ({ extends: [recommended(), workflowPolicy()] });\n","import { fileURLToPath } from \"node:url\";\n\nimport { RuleConfigSeverity } from \"@commitlint/types\";\nimport type { ToolSections } from \"@r_masseater/vite-plus-adopt\";\nimport { Option, pipe } from \"effect\";\n\nexport interface CommitOptions {\n readonly subjectScripts: readonly string[];\n}\n\nexport type CommitlintSection = NonNullable<ToolSections[\"commitlint\"]>;\n\nconst COMMIT_CONVENTION = fileURLToPath(import.meta.resolve(\"@commitlint/config-conventional\"));\n\nexport const COMMIT_LINT = { extends: [COMMIT_CONVENTION] };\n\nexport const SUBJECT_SCRIPT = \"subject-script\";\n\nexport const commitlintOf = (commit: CommitOptions | undefined): CommitlintSection =>\n pipe(\n Option.fromUndefinedOr(commit),\n Option.match({\n onNone: (): CommitlintSection => COMMIT_LINT,\n onSome: ({ subjectScripts }): CommitlintSection => ({\n ...COMMIT_LINT,\n rules: { [SUBJECT_SCRIPT]: [RuleConfigSeverity.Error, \"always\", [...subjectScripts]] },\n }),\n }),\n );\n","import { RUNTIME_SECTIONS } from \"@r_masseater/masseater-utils/kestrion\";\nimport type { DependencySection } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Record as Rec, pipe } from \"effect\";\nimport type { UserConfig } from \"vite-plus\";\n\nimport type { WorkspaceSettings } from \"#/features/build-workspace-settings/index.ts\";\nimport { requiredStack } from \"#/features/define-lint-preset/index.ts\";\n\nexport type DependencyRules = NonNullable<UserConfig[\"dependencyRules\"]>;\ntype Allowed = NonNullable<DependencyRules[\"allowed\"]>;\n\nconst allowedIn = (\n allowances: WorkspaceSettings[\"devDependencies\"],\n fields: readonly DependencySection[],\n): Allowed =>\n pipe(\n allowances,\n Rec.map(({ workspaces, dependencies }) => ({ workspaces, dependencies, fields: [...fields] })),\n );\n\nexport const PLUGIN_DEPENDENCIES =\n \"Claude Code installs a plugin's dependencies from its own package.json and lockfile, where only exact registry versions install\";\n\nexport const dependencyRulesOf = (workspace: WorkspaceSettings): DependencyRules => ({\n allowed: {\n ...allowedIn(workspace.devDependencies, [\"devDependencies\"]),\n ...allowedIn(workspace.dependencies, RUNTIME_SECTIONS),\n },\n banned: requiredStack,\n exactDependencies: { [PLUGIN_DEPENDENCIES]: workspace.plugins },\n peerRanges: \"intersect\",\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport type { UserConfig } from \"vite-plus\";\n\nimport type {\n AddedRulesValue,\n WorkspaceSettings,\n} from \"#/features/build-workspace-settings/index.ts\";\nimport type { MarkdownOptions } from \"#/features/define-lint-preset/index.ts\";\nimport {\n decisionTestRules,\n exempt,\n lint as preset,\n markdownOf,\n structureOf,\n} from \"#/features/define-lint-preset/index.ts\";\nimport { fu4Of } from \"#/features/guard-workflows/index.ts\";\n\nimport { recordBuilt } from \"./built-config.ts\";\nimport { commitlintOf } from \"./repository-commit.ts\";\nimport type { CommitOptions } from \"./repository-commit.ts\";\nimport { dependencyRulesOf } from \"./repository-dependencies.ts\";\nimport { gitHooksOf, tasksOf } from \"./repository-tasks.ts\";\nimport type { CargoInputs, GitHooksSection, UsageOptions } from \"./repository-tasks.ts\";\nimport { secretsOf, textlintOf } from \"./repository-text.ts\";\nimport type { TextOptions } from \"./repository-text.ts\";\n\nexport { COMMIT_LINT } from \"./repository-commit.ts\";\nexport { PLUGIN_DEPENDENCIES } from \"./repository-dependencies.ts\";\nexport { secretsOf } from \"./repository-text.ts\";\nexport { GIT_HOOKS } from \"./repository-tasks.ts\";\n\nexport interface AddedOverride {\n readonly files: readonly string[];\n readonly excludeFiles?: readonly string[];\n readonly rules: AddedRulesValue;\n}\n\nexport interface RepositoryOptions {\n readonly workspace: WorkspaceSettings;\n readonly commit?: CommitOptions;\n readonly overrides?: readonly AddedOverride[];\n readonly textlint?: TextOptions;\n readonly markdown?: Omit<MarkdownOptions, \"indexSkill\">;\n readonly run?: {\n readonly tasks?: Readonly<Record<string, string>>;\n readonly remoteCache?: string;\n };\n readonly usage?: UsageOptions;\n readonly cargo?: { readonly inputs: CargoInputs };\n readonly gitHooks?: GitHooksSection;\n}\n\ntype OxlintOverride = NonNullable<NonNullable<UserConfig[\"lint\"]>[\"overrides\"]>[number];\n\ninterface SharedCache {\n readonly scripts: true;\n readonly tasks: true;\n readonly remote: { readonly url: string };\n}\n\nconst cacheOf = (remoteCache: string | undefined): SharedCache | true =>\n pipe(\n Option.fromNullishOr(remoteCache),\n Option.match({\n onNone: (): SharedCache | true => true,\n onSome: (url) => ({ scripts: true, tasks: true, remote: { url } }),\n }),\n );\n\nexport const STAGED = { \"*\": \"vp fmt --no-error-on-unmatched-pattern\" };\n\nexport const FORMAT = {\n ignorePatterns: exempt,\n sortImports: true,\n sortTailwindcss: true,\n sortPackageJson: true,\n};\n\nconst added = ({ files, excludeFiles, rules }: AddedOverride): OxlintOverride =>\n pipe(\n Option.fromUndefinedOr(excludeFiles),\n Option.match({\n onNone: (): OxlintOverride => ({ files: [...files], rules: { ...rules } }),\n onSome: (excluded): OxlintOverride => ({\n files: [...files],\n excludeFiles: [...excluded],\n rules: { ...rules },\n }),\n }),\n );\n\nconst lintOf = ({\n workspace,\n overrides = [],\n}: RepositoryOptions): NonNullable<UserConfig[\"lint\"]> => ({\n ...preset,\n ignorePatterns: exempt,\n overrides: [\n ...preset.overrides,\n {\n files: [...workspace.lint.shadcnUi],\n rules: { \"react/jsx-props-no-spreading\": \"off\" },\n },\n {\n files: [\n ...workspace.lint.publicEntries,\n ...workspace.lint.deployEntries,\n ...workspace.lint.siteEntries,\n ],\n rules: { \"import/no-default-export\": \"off\" },\n },\n ...pipe(overrides, Arr.map(added)),\n ...workspace.lint.overrides,\n { files: [\"**/*.test.ts\"], rules: decisionTestRules },\n ],\n});\n\nexport const repositoryConfig = (options: RepositoryOptions): UserConfig => {\n const {\n workspace,\n commit,\n textlint = {},\n markdown = {},\n run = {},\n usage,\n cargo,\n gitHooks,\n } = options;\n const cargoInputs = Option.map(Option.fromUndefinedOr(cargo), ({ inputs }) => inputs);\n return recordBuilt({\n commitlint: commitlintOf(commit),\n dependencyRules: dependencyRulesOf(workspace),\n h56m: secretsOf(),\n wism: structureOf({\n members: workspace.members,\n ignorePatterns: exempt,\n }),\n textlint: textlintOf({ ...textlint, articles: workspace.articles }),\n y8: markdownOf({ ...markdown, indexSkill: workspace.indexSkill }),\n fu4: fu4Of(),\n test: { projects: [...workspace.testProjects], passWithNoTests: true },\n staged: STAGED,\n gitHooks: gitHooksOf(gitHooks),\n fmt: FORMAT,\n lint: lintOf(options),\n run: {\n cache: cacheOf(run.remoteCache),\n tasks: tasksOf({\n workspace,\n commands: run.tasks ?? {},\n usage: Option.fromUndefinedOr(usage),\n cargo: cargoInputs,\n }),\n },\n });\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,UAAU,EAAE,aACvB,OAAO,cAAc,OAAO,IAAI;AAElC,MAAa,YAAY,SACvB,KACE,MACA,OAAO,QAAQ,EAAE,WAAW,SAAS,QAAQ,GAC7C,OAAO,KAAK,EAAE,OAAO,MAAM,cAAc;CAAE,MAAM;CAAO;CAAM;AAAO,EAAE,CACzE;AAEF,MAAa,WACV,SACA,SACC,KAAK,MAAM,OAAO,QAAQ,QAAQ,GAAG,CAAC,CAAC;AAE3C,MAAa,aACV,SACA,SACC,KACE,MACA,OAAO,SAAS,YACd,KACE,QAAQ,OAAO,GACfA,MAAI,WAAW,SAAS,KAAK,IAAI,UAAU,GAAG,GAC9C,OAAO,KAAK,SAAS,KAAK,GAAG,CAC/B,CACF,CACF;AAEJ,MAAa,WAAW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K;EACrE,QAAQ;EACR,UAAU,WAAW,QAAQ;EAC7B,KAAK;EACL,MAAM,OAAO,OAAO;EACpB,KAAK;GACH,OAAO,QAAQ,IAAI,WAAW;GAC9B,OAAO,QAAQ;IACb;IACA,UAAU,IAAI,SAAS,CAAC;IACxB,OAAO,OAAO,gBAAgB,KAAK;IACnC,OAAO;GACT,CAAC;EACH;CACF,CAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Option } from "effect";
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
2
|
import { OxlintOverride } from "vite-plus/lint";
|
|
3
3
|
import "effect/process";
|
|
4
4
|
import "@r_masseater/masseater-utils/kestrion/pnpm";
|
|
@@ -48,4 +48,6 @@ interface SettingsOptions {
|
|
|
48
48
|
readonly dependencySets: DependencySets;
|
|
49
49
|
}
|
|
50
50
|
declare const workspaceSettings: (options: SettingsOptions) => Promise<WorkspaceSettings>;
|
|
51
|
-
|
|
51
|
+
declare const AddedRules: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Literals<readonly ["error", "deny"]>, Schema.mutable<Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Literals<readonly ["error", "deny"]>]>, readonly [Schema.Unknown]>>]>>;
|
|
52
|
+
type AddedRulesValue = typeof AddedRules.Type;
|
|
53
|
+
export { WorkspaceLint as a, DependencyAllowance as c, ignoredDirectories as d, WorkspaceTasks as f, SettingsOptions as i, DependencySets as l, RuleSet as n, WorkspaceSettings as o, RuleSets as r, workspaceSettings as s, AddedRulesValue as t, IgnoredDirectory as u };
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { r as RepositoryFiles } from "./repository-files-C_GzAnYp.mjs";
|
|
2
|
+
import { c as TASK_NAMES, i as workspaceProjects } from "./workspace-projects-eapoa0az.mjs";
|
|
3
|
+
import { a as textlintFilters, i as zennMarkdown, o as textlintPresets, x as exempt } from "./define-lint-preset-PLWK5HYf.mjs";
|
|
4
|
+
import { i as USAGE_SPOOL } from "./config-B3SYjao5.mjs";
|
|
5
|
+
import { Array, Effect, Option, Record, String as String$1, pipe } from "effect";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import manifest from "@r_masseater/mdlct/package.json" with { type: "json" };
|
|
8
|
+
import { betterleaks } from "@r_masseater/h56m/presets";
|
|
9
|
+
// src/entities/workspace/model/workspace-names.ts
|
|
10
|
+
const ALTERNATIVE = "|";
|
|
11
|
+
const SCOPE = /^@[^/]+\//u;
|
|
12
|
+
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
13
|
+
/** @internal */
|
|
14
|
+
const patternOf = (names) => {
|
|
15
|
+
const alternatives = pipe(names, Array.map(String$1.replaceAll(SPECIAL, String.raw`\$&`)));
|
|
16
|
+
return new RegExp(`(?<![\\p{L}\\p{N}_-])(?:${Array.join(alternatives, ALTERNATIVE)})(?![\\p{L}\\p{N}_-])`, "gu");
|
|
17
|
+
};
|
|
18
|
+
const namedIn = (basename) => ({ directory, packageName }) => {
|
|
19
|
+
const unscoped = pipe(packageName, Option.map(String$1.replace(SCOPE, "")));
|
|
20
|
+
return {
|
|
21
|
+
directory,
|
|
22
|
+
names: pipe([
|
|
23
|
+
Option.some(directory),
|
|
24
|
+
Option.some(basename(directory)),
|
|
25
|
+
packageName,
|
|
26
|
+
unscoped
|
|
27
|
+
], Array.getSomes, Array.dedupe),
|
|
28
|
+
packageName
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** @internal */
|
|
32
|
+
const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(root) {
|
|
33
|
+
const files = yield* RepositoryFiles;
|
|
34
|
+
const projects = yield* workspaceProjects(root);
|
|
35
|
+
return pipe(projects, Array.map(namedIn((directory) => files.basename(directory))));
|
|
36
|
+
});
|
|
37
|
+
// src/shared/lib/path-existence.ts
|
|
38
|
+
const WILDCARD = /[*?[]/u;
|
|
39
|
+
const SEPARATOR = "/";
|
|
40
|
+
const FIRST = 0;
|
|
41
|
+
/** @internal */
|
|
42
|
+
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
43
|
+
const files = yield* RepositoryFiles;
|
|
44
|
+
return yield* files.exists(files.join(root, path));
|
|
45
|
+
});
|
|
46
|
+
/** @internal */
|
|
47
|
+
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
48
|
+
const files = yield* RepositoryFiles;
|
|
49
|
+
const directory = yield* files.isDirectory(files.join(root, path));
|
|
50
|
+
return Option.getOrElse(directory, () => false);
|
|
51
|
+
});
|
|
52
|
+
/** @internal */
|
|
53
|
+
const staticPrefix = (path) => {
|
|
54
|
+
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
|
|
55
|
+
if (String$1.endsWith(SEPARATOR)(prefix)) return String$1.slice(FIRST, -1)(prefix);
|
|
56
|
+
return prefix;
|
|
57
|
+
};
|
|
58
|
+
/** @internal */
|
|
59
|
+
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
60
|
+
const prefix = staticPrefix(path);
|
|
61
|
+
if (String$1.isEmpty(prefix)) return false;
|
|
62
|
+
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR}`]);
|
|
63
|
+
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
64
|
+
});
|
|
65
|
+
// src/app/built-config.ts
|
|
66
|
+
/** @internal */
|
|
67
|
+
const recordBuilt = (config) => {
|
|
68
|
+
globalThis.mschBuiltConfig = [config];
|
|
69
|
+
return config;
|
|
70
|
+
};
|
|
71
|
+
/** @internal */
|
|
72
|
+
const forgetBuilt = () => {
|
|
73
|
+
globalThis.mschBuiltConfig = [];
|
|
74
|
+
};
|
|
75
|
+
/** @internal */
|
|
76
|
+
const lastBuilt = () => pipe(Option.fromUndefinedOr(globalThis.mschBuiltConfig), Option.flatMap(Array.head));
|
|
77
|
+
// src/shared/lib/mdlct.ts
|
|
78
|
+
/** @internal */
|
|
79
|
+
const MDLCT_BIN = fileURLToPath(new URL(manifest.bin.mdlct, import.meta.resolve("@r_masseater/mdlct/package.json")));
|
|
80
|
+
// src/app/repository-tasks.ts
|
|
81
|
+
const NOT_INPUTS = [
|
|
82
|
+
"!node_modules/.pnpm-store",
|
|
83
|
+
"!node_modules/.pnpm-store/**",
|
|
84
|
+
"!node_modules/.tmp",
|
|
85
|
+
"!node_modules/.tmp/**",
|
|
86
|
+
"!target/**",
|
|
87
|
+
"!node_modules/.vitest-cache/**",
|
|
88
|
+
"!node_modules/.cache/**"
|
|
89
|
+
];
|
|
90
|
+
const UNTRACKED_ENV = [
|
|
91
|
+
"CLOUDFLARE_ACCOUNT_ID",
|
|
92
|
+
"CLOUDFLARE_AI_GATEWAY_ID",
|
|
93
|
+
"CLOUDFLARE_API_TOKEN",
|
|
94
|
+
"CLAUDECODE",
|
|
95
|
+
"CLAUDE_CODE_REMOTE",
|
|
96
|
+
"GITHUB_ACTIONS",
|
|
97
|
+
"HTTPS_PROXY",
|
|
98
|
+
"https_proxy",
|
|
99
|
+
"NO_PROXY",
|
|
100
|
+
"no_proxy",
|
|
101
|
+
"SSL_CERT_FILE",
|
|
102
|
+
"NODE_EXTRA_CA_CERTS"
|
|
103
|
+
];
|
|
104
|
+
const FALLOW = pipe([
|
|
105
|
+
"--skip dupes --fail-on-issues --quiet --format compact",
|
|
106
|
+
"dead-code --no-production --fail-on-issues --quiet --format compact",
|
|
107
|
+
"dead-code --no-production --quiet --format json | jq -n 'input | {prop_drilling_chains, thin_wrappers, duplicate_prop_shapes} | with_entries(select(.value | length > 0)) | if length > 0 then halt_error else empty end'",
|
|
108
|
+
"dupes --fail-on-issues --quiet --format compact",
|
|
109
|
+
"security --fail-on-issues --quiet"
|
|
110
|
+
], Array.map((args) => `FALLOW_TYPE_AWARE_BACKEND=tsrs fallow ${args}`));
|
|
111
|
+
const CHECK = `TSRS_LINT_RUN_EXTERNAL_CODE=1 msch changed --batch-sources ${String(1e3)} -- vp check --deny-warnings --continue-on-error --no-error-on-unmatched-pattern`;
|
|
112
|
+
const COMPAT = "msch changed -- msch publish compat-changed";
|
|
113
|
+
const SKILLS = `node ${MDLCT_BIN} check`;
|
|
114
|
+
const AUDIT = Array.join([
|
|
115
|
+
"copy=\"$(mktemp -d)\"",
|
|
116
|
+
`trap 'rm -rf "$copy"' EXIT`,
|
|
117
|
+
`for file in ${Array.join([
|
|
118
|
+
"package.json",
|
|
119
|
+
"pnpm-workspace.yaml",
|
|
120
|
+
"pnpm-lock.yaml",
|
|
121
|
+
".npmrc"
|
|
122
|
+
], " ")}; do if [ -f "$file" ]; then cp "$file" "$copy/"; fi; done`,
|
|
123
|
+
"(cd \"$copy\" && vp pm audit --fix >/dev/null) || exit",
|
|
124
|
+
`added="$(diff pnpm-workspace.yaml "$copy/pnpm-workspace.yaml" | sed -n 's/^> \\(.*\\)$/\\1 # exit: unused/p')"`,
|
|
125
|
+
"if [ -z \"$added\" ]; then exit 0; fi",
|
|
126
|
+
`printf '%s\\n' "vp pm audit --fix found vulnerable versions. First update them within their ranges with vp update -r --no-save <package>... -- --depth Infinity. For each one still reported by vp pm audit, add its line to overrides in pnpm-workspace.yaml and run vp install:" "$added" >&2`,
|
|
127
|
+
"exit 1"
|
|
128
|
+
], "; ");
|
|
129
|
+
const BROKER_TOKEN = `GH_TOKEN="\${GITHUB_APP_TOKEN:-$GH_TOKEN}"`;
|
|
130
|
+
const DAILY = `msch exits; ${BROKER_TOKEN} msch upstream; ${BROKER_TOKEN} msch callers; ${BROKER_TOKEN} msch refs; refs=$?; msch agents "\${RUNNER_TEMP:-\${TMPDIR:-/tmp}}/msch-agents" && exit "$refs"`;
|
|
131
|
+
const TEST = "msch changed -- vp test run --passWithNoTests";
|
|
132
|
+
const CARGO = "cargo fmt --all --check && cargo clippy --workspace --all-targets --locked -- -D warnings";
|
|
133
|
+
const cargoTasks = (cargo) => Option.match(cargo, {
|
|
134
|
+
onNone: () => ({}),
|
|
135
|
+
onSome: (inputs) => ({ cargo: {
|
|
136
|
+
command: CARGO,
|
|
137
|
+
cache: {
|
|
138
|
+
input: [...inputs],
|
|
139
|
+
output: [],
|
|
140
|
+
untrackedEnv: UNTRACKED_ENV
|
|
141
|
+
}
|
|
142
|
+
} })
|
|
143
|
+
});
|
|
144
|
+
const MSCH_VERIFY_COMMANDS = {
|
|
145
|
+
fallow: FALLOW,
|
|
146
|
+
check: CHECK,
|
|
147
|
+
msch: "msch",
|
|
148
|
+
audit: AUDIT,
|
|
149
|
+
published: "msch published",
|
|
150
|
+
compat: COMPAT,
|
|
151
|
+
skills: SKILLS
|
|
152
|
+
};
|
|
153
|
+
const MSCH_TASK_COMMANDS = {
|
|
154
|
+
...MSCH_VERIFY_COMMANDS,
|
|
155
|
+
test: TEST
|
|
156
|
+
};
|
|
157
|
+
const CI_TASKS = [TASK_NAMES.verify, TASK_NAMES.test];
|
|
158
|
+
const USAGE_TASK = "usage";
|
|
159
|
+
const METERED_TASKS = ["check", "msch"];
|
|
160
|
+
const meteredCommand = (command) => `USAGE_METER_SPOOL="$PWD/${USAGE_SPOOL}" ${command}`;
|
|
161
|
+
const usageCommandOf = ({ endpoint, apiKeyEnv }) => pipe(Option.fromUndefinedOr(apiKeyEnv), Option.match({
|
|
162
|
+
onNone: () => `msch usage --endpoint ${endpoint}`,
|
|
163
|
+
onSome: (name) => `msch usage --endpoint ${endpoint} --api-key-env ${name}`
|
|
164
|
+
}));
|
|
165
|
+
const commandOf = (usage) => (command) => Option.match(usage, {
|
|
166
|
+
onNone: () => command,
|
|
167
|
+
onSome: () => meteredCommand(command)
|
|
168
|
+
});
|
|
169
|
+
const usageTasks = (usage) => Option.match(usage, {
|
|
170
|
+
onNone: () => ({}),
|
|
171
|
+
onSome: (options) => ({ [USAGE_TASK]: {
|
|
172
|
+
command: usageCommandOf(options),
|
|
173
|
+
dependsOn: [...METERED_TASKS],
|
|
174
|
+
cache: false
|
|
175
|
+
} })
|
|
176
|
+
});
|
|
177
|
+
const tasksOf = ({ workspace, commands, usage, cargo }) => {
|
|
178
|
+
const inputs = [
|
|
179
|
+
{ auto: true },
|
|
180
|
+
...workspace.ignoredDirectories,
|
|
181
|
+
...NOT_INPUTS
|
|
182
|
+
];
|
|
183
|
+
const run = commandOf(usage);
|
|
184
|
+
const checks = {
|
|
185
|
+
...commands,
|
|
186
|
+
fallow: {
|
|
187
|
+
command: FALLOW,
|
|
188
|
+
cache: {
|
|
189
|
+
input: [
|
|
190
|
+
...inputs,
|
|
191
|
+
"!.fallow/**",
|
|
192
|
+
"!**/dist/**",
|
|
193
|
+
"!**/.fallow-verified"
|
|
194
|
+
],
|
|
195
|
+
output: []
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
check: {
|
|
199
|
+
command: run(CHECK),
|
|
200
|
+
cache: {
|
|
201
|
+
input: inputs,
|
|
202
|
+
untrackedEnv: UNTRACKED_ENV
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
msch: {
|
|
206
|
+
command: run(MSCH_VERIFY_COMMANDS.msch),
|
|
207
|
+
dependsOn: ["check", ...workspace.tasks.native],
|
|
208
|
+
cache: false
|
|
209
|
+
},
|
|
210
|
+
audit: {
|
|
211
|
+
command: AUDIT,
|
|
212
|
+
cache: false
|
|
213
|
+
},
|
|
214
|
+
skills: {
|
|
215
|
+
command: SKILLS,
|
|
216
|
+
cache: {
|
|
217
|
+
input: inputs,
|
|
218
|
+
output: []
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
published: {
|
|
222
|
+
command: MSCH_TASK_COMMANDS.published,
|
|
223
|
+
cache: false
|
|
224
|
+
},
|
|
225
|
+
compat: {
|
|
226
|
+
command: COMPAT,
|
|
227
|
+
dependsOn: ["msch", "fallow"],
|
|
228
|
+
cache: false
|
|
229
|
+
},
|
|
230
|
+
...cargoTasks(cargo),
|
|
231
|
+
...usageTasks(usage)
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
...checks,
|
|
235
|
+
test: {
|
|
236
|
+
command: TEST,
|
|
237
|
+
dependsOn: ["check", ...workspace.tasks.native],
|
|
238
|
+
cache: { input: [...inputs, "!**/.cache/**"] }
|
|
239
|
+
},
|
|
240
|
+
daily: {
|
|
241
|
+
command: DAILY,
|
|
242
|
+
dependsOn: [...workspace.tasks.native],
|
|
243
|
+
cache: false
|
|
244
|
+
},
|
|
245
|
+
verify: {
|
|
246
|
+
command: [],
|
|
247
|
+
dependsOn: [...workspace.tasks.verify, ...Record.keys(checks)]
|
|
248
|
+
},
|
|
249
|
+
ci: {
|
|
250
|
+
command: [],
|
|
251
|
+
dependsOn: [...CI_TASKS, ...workspace.tasks.test]
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
const REINSTALL = "vp install";
|
|
256
|
+
const GIT_HOOKS = {
|
|
257
|
+
"pre-commit": ["vp staged", "vp exec msch --staged"],
|
|
258
|
+
"commit-msg": ["vp exec msch --commit-msg \"$1\""],
|
|
259
|
+
"pre-push": ["vp exec msch --pre-push", "vp run verify"],
|
|
260
|
+
"post-checkout": [`[ "$3" = 0 ] || ${REINSTALL}`],
|
|
261
|
+
"post-merge": [REINSTALL],
|
|
262
|
+
"post-rewrite": [REINSTALL]
|
|
263
|
+
};
|
|
264
|
+
const gitHooksOf = (hooks = {}) => ({
|
|
265
|
+
...GIT_HOOKS,
|
|
266
|
+
...hooks
|
|
267
|
+
});
|
|
268
|
+
// src/app/repository-text.ts
|
|
269
|
+
const TEXT_IGNORES = [
|
|
270
|
+
"AGENTS.md",
|
|
271
|
+
"CLAUDE.md",
|
|
272
|
+
".agents/skills/**",
|
|
273
|
+
"CHANGELOG.md",
|
|
274
|
+
...exempt
|
|
275
|
+
];
|
|
276
|
+
const ZENN_MARKDOWN = "zenn-markdown";
|
|
277
|
+
const QUOTATION = String.raw`/「(?:[^「」]|「[^「」]*」)*」|『(?:[^『』]|『[^『』]*』)*』/`;
|
|
278
|
+
const SPEAKER = String.raw`/^:::[\w-]+\n[\s\S]*?\n:::$/m`;
|
|
279
|
+
const ELLIPSIS = "…";
|
|
280
|
+
/** @internal */
|
|
281
|
+
const BUILT_ALLOWANCES = [QUOTATION, SPEAKER];
|
|
282
|
+
const filtersOf = (properNouns) => ({
|
|
283
|
+
comments: true,
|
|
284
|
+
"node-types": { nodeTypes: ["BlockQuote"] },
|
|
285
|
+
allowlist: { allow: [...BUILT_ALLOWANCES, ...properNouns] }
|
|
286
|
+
});
|
|
287
|
+
const SENTENCE_LENGTH = 120;
|
|
288
|
+
const KANJI_RUN = 6;
|
|
289
|
+
const PUBLIC_LINES = [
|
|
290
|
+
String.raw`\bCF_BEACON_TOKEN = "[0-9a-f]{32}"`,
|
|
291
|
+
String.raw`\b\w*DISCORD_\w*ID = "[0-9]{17,20}"`,
|
|
292
|
+
String.raw`untrusted comment: minisign public key: [0-9A-F]{16}`
|
|
293
|
+
];
|
|
294
|
+
const EXEMPT_PATHS = [String.raw`(?:^|/)(?:fixtures|upstream|hooks/vendor)/`];
|
|
295
|
+
const builtRules = (style) => ({
|
|
296
|
+
"@textlint-ja/preset-ai-writing": true,
|
|
297
|
+
"@r_masseater/preset-ja": true,
|
|
298
|
+
"preset-ja-technical-writing": {
|
|
299
|
+
"sentence-length": { max: SENTENCE_LENGTH },
|
|
300
|
+
"ja-no-mixed-period": { allowPeriodMarks: [":"] },
|
|
301
|
+
"no-mix-dearu-desumasu": {
|
|
302
|
+
preferInBody: style,
|
|
303
|
+
preferInList: style
|
|
304
|
+
},
|
|
305
|
+
"max-kanji-continuous-len": { max: KANJI_RUN },
|
|
306
|
+
"ja-no-successive-word": { allow: [ELLIPSIS] }
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
const textlintOf = ({ properNouns = [], rules = {}, sources = [], articles }) => {
|
|
310
|
+
const textRules = {
|
|
311
|
+
...rules,
|
|
312
|
+
...builtRules("である")
|
|
313
|
+
};
|
|
314
|
+
const filters = filtersOf(properNouns);
|
|
315
|
+
const articleSources = Array.filter([{
|
|
316
|
+
files: [...articles],
|
|
317
|
+
plugins: { [ZENN_MARKDOWN]: true },
|
|
318
|
+
rules: {
|
|
319
|
+
...rules,
|
|
320
|
+
...builtRules("ですます")
|
|
321
|
+
},
|
|
322
|
+
filters
|
|
323
|
+
}], () => Array.isReadonlyArrayNonEmpty(articles));
|
|
324
|
+
return {
|
|
325
|
+
ignores: [...TEXT_IGNORES, ...articles],
|
|
326
|
+
presets: textlintPresets,
|
|
327
|
+
filterModules: textlintFilters,
|
|
328
|
+
pluginModules: { [ZENN_MARKDOWN]: zennMarkdown },
|
|
329
|
+
reportUnusedDirectives: true,
|
|
330
|
+
sources: pipe(sources, Array.map(({ files, plugins }) => ({
|
|
331
|
+
files: [...files],
|
|
332
|
+
plugins: { ...plugins },
|
|
333
|
+
rules: textRules,
|
|
334
|
+
filters
|
|
335
|
+
})), Array.appendAll(articleSources)),
|
|
336
|
+
filters,
|
|
337
|
+
rules: textRules
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
const anyOf = (subject) => (patterns) => {
|
|
341
|
+
if (Array.isReadonlyArrayEmpty(patterns)) return [];
|
|
342
|
+
return [`matchesAny(${subject}, [${pipe(patterns, Array.map((pattern) => `\`${pattern}\``), Array.join(", "))}])`];
|
|
343
|
+
};
|
|
344
|
+
const secretsOf = () => ({
|
|
345
|
+
extend: { path: betterleaks },
|
|
346
|
+
filter: pipe([...anyOf("finding.line")(PUBLIC_LINES), ...anyOf(`attributes["path"]`)(EXEMPT_PATHS)], Array.join(" || "))
|
|
347
|
+
});
|
|
348
|
+
export { gitHooksOf as a, forgetBuilt as c, existsAt as d, isDirectoryAt as f, patternOf as g, namedWorkspaces as h, GIT_HOOKS as i, lastBuilt as l, staticPrefix as m, secretsOf as n, tasksOf as o, isIgnored as p, textlintOf as r, MDLCT_BIN as s, BUILT_ALLOWANCES as t, recordBuilt as u };
|
|
349
|
+
|
|
350
|
+
//# sourceMappingURL=repository-text-Dy8EkFIh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-text-Dy8EkFIh.mjs","names":["Arr","Str","Arr","Str","Arr","Arr","Rec","Arr"],"sources":["../src/entities/workspace/model/workspace-names.ts","../src/shared/lib/path-existence.ts","../src/app/built-config.ts","../src/shared/lib/mdlct.ts","../src/app/repository-tasks.ts","../src/app/repository-text.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceProjects } from \"./workspace-projects.ts\";\nimport type { WorkspaceProject } from \"./workspace-projects.ts\";\n\nconst ALTERNATIVE = \"|\";\nconst SCOPE = /^@[^/]+\\//u;\nconst SPECIAL = /[$()*+.?[\\\\\\]^{|}]/gu;\n\nexport interface NamedWorkspace {\n readonly directory: string;\n readonly names: readonly string[];\n readonly packageName: Option.Option<string>;\n}\n\n/** @internal */\nexport const patternOf = (names: readonly string[]): RegExp => {\n const alternatives = pipe(names, Arr.map(Str.replaceAll(SPECIAL, String.raw`\\$&`)));\n return new RegExp(\n `(?<![\\\\p{L}\\\\p{N}_-])(?:${Arr.join(alternatives, ALTERNATIVE)})(?![\\\\p{L}\\\\p{N}_-])`,\n \"gu\",\n );\n};\n\nconst namedIn =\n (basename: (directory: string) => string) =>\n ({ directory, packageName }: WorkspaceProject): NamedWorkspace => {\n const unscoped = pipe(packageName, Option.map(Str.replace(SCOPE, \"\")));\n const names = pipe(\n [Option.some(directory), Option.some(basename(directory)), packageName, unscoped],\n Arr.getSomes,\n Arr.dedupe,\n );\n return { directory, names, packageName };\n };\n\n/** @internal */\nexport const namedWorkspaces = Effect.fn(\"namedWorkspaces\")(function* namedWorkspaces(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const projects = yield* workspaceProjects(root);\n return pipe(projects, Arr.map(namedIn((directory) => files.basename(directory))));\n});\n","import { Array as Arr, Effect, Option, String as Str } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst WILDCARD = /[*?[]/u;\nconst SEPARATOR = \"/\";\nconst FIRST = 0;\n\n/** @internal */\nexport const existsAt = Effect.fn(\"existsAt\")(function* existsAt(root: string, path: string) {\n const files = yield* RepositoryFiles;\n return yield* files.exists(files.join(root, path));\n});\n\n/** @internal */\nexport const isDirectoryAt = Effect.fn(\"isDirectoryAt\")(function* isDirectoryAt(\n root: string,\n path: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* files.isDirectory(files.join(root, path));\n return Option.getOrElse(directory, () => false);\n});\n\n/** @internal */\nexport const staticPrefix = (path: string): string => {\n const prefix = Arr.headNonEmpty(Str.split(path, WILDCARD));\n if (Str.endsWith(SEPARATOR)(prefix)) {\n return Str.slice(FIRST, -SEPARATOR.length)(prefix);\n }\n return prefix;\n};\n\n/** @internal */\nexport const isIgnored = Effect.fn(\"isIgnored\")(function* isIgnored(root: string, path: string) {\n const prefix = staticPrefix(path);\n if (Str.isEmpty(prefix)) {\n return false;\n }\n const files = yield* RepositoryFiles;\n const ignored = yield* files.ignoredPaths(root, [prefix, `${prefix}${SEPARATOR}`]);\n return Arr.isReadonlyArrayNonEmpty(ignored);\n});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { FinalConfig } from \"./config-sections.ts\";\n\ndeclare global {\n var mschBuiltConfig: readonly FinalConfig[] | undefined;\n}\n\n/** @internal */\nexport const recordBuilt = <Config extends FinalConfig>(config: Config): Config => {\n globalThis.mschBuiltConfig = [config];\n return config;\n};\n\n/** @internal */\nexport const forgetBuilt = (): void => {\n globalThis.mschBuiltConfig = [];\n};\n\n/** @internal */\nexport const lastBuilt = (): Option.Option<FinalConfig> =>\n pipe(Option.fromUndefinedOr(globalThis.mschBuiltConfig), Option.flatMap(Arr.head));\n","import { fileURLToPath } from \"node:url\";\n\nimport manifest from \"@r_masseater/mdlct/package.json\" with { type: \"json\" };\n\n/** @internal */\nexport const MDLCT_BIN = fileURLToPath(\n new URL(manifest.bin.mdlct, import.meta.resolve(\"@r_masseater/mdlct/package.json\")),\n);\n","import type { GitHooksSection } from \"@r_masseater/vite-plus-adopt\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\nimport type { UserConfig } from \"vite-plus\";\n\nimport { TASK_NAMES } from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSettings } from \"#/features/build-workspace-settings/index.ts\";\nimport type { CargoInput } from \"#/features/derive-cargo-inputs/index.ts\";\nimport { USAGE_SPOOL } from \"#/shared/config/index.ts\";\nimport { MDLCT_BIN } from \"#/shared/lib/mdlct.ts\";\n\nexport type { GitHooksSection } from \"@r_masseater/vite-plus-adopt\";\n\ntype Tasks = NonNullable<NonNullable<UserConfig[\"run\"]>[\"tasks\"]>;\n\nexport interface UsageOptions {\n readonly endpoint: string;\n readonly apiKeyEnv?: string;\n}\n\nexport interface TaskOptions {\n readonly workspace: WorkspaceSettings;\n readonly commands: Readonly<Record<string, string>>;\n readonly usage: Option.Option<UsageOptions>;\n readonly cargo: Option.Option<CargoInputs>;\n}\n\nexport type CargoInputs = readonly CargoInput[];\n\nconst NOT_INPUTS = [\n \"!node_modules/.pnpm-store\",\n \"!node_modules/.pnpm-store/**\",\n \"!node_modules/.tmp\",\n \"!node_modules/.tmp/**\",\n \"!target/**\",\n \"!node_modules/.vitest-cache/**\",\n \"!node_modules/.cache/**\",\n];\n\nconst UNTRACKED_ENV = [\n \"CLOUDFLARE_ACCOUNT_ID\",\n \"CLOUDFLARE_AI_GATEWAY_ID\",\n \"CLOUDFLARE_API_TOKEN\",\n \"CLAUDECODE\",\n \"CLAUDE_CODE_REMOTE\",\n \"GITHUB_ACTIONS\",\n \"HTTPS_PROXY\",\n \"https_proxy\",\n \"NO_PROXY\",\n \"no_proxy\",\n \"SSL_CERT_FILE\",\n \"NODE_EXTRA_CA_CERTS\",\n];\n\nconst FALLOW_ARGS = [\n \"--skip dupes --fail-on-issues --quiet --format compact\",\n \"dead-code --no-production --fail-on-issues --quiet --format compact\",\n \"dead-code --no-production --quiet --format json | jq -n 'input | {prop_drilling_chains, thin_wrappers, duplicate_prop_shapes} | with_entries(select(.value | length > 0)) | if length > 0 then halt_error else empty end'\",\n \"dupes --fail-on-issues --quiet --format compact\",\n \"security --fail-on-issues --quiet\",\n];\n\nconst FALLOW = pipe(\n FALLOW_ARGS,\n Arr.map((args) => `FALLOW_TYPE_AWARE_BACKEND=tsrs fallow ${args}`),\n);\n\nconst CHECK_BATCH_SOURCES = 1000;\n\nconst CHECK = `TSRS_LINT_RUN_EXTERNAL_CODE=1 msch changed --batch-sources ${String(CHECK_BATCH_SOURCES)} -- vp check --deny-warnings --continue-on-error --no-error-on-unmatched-pattern`;\n\nconst COMPAT = \"msch changed -- msch publish compat-changed\";\n\nconst SKILLS = `node ${MDLCT_BIN} check`;\n\nconst AUDIT_FILES = [\"package.json\", \"pnpm-workspace.yaml\", \"pnpm-lock.yaml\", \".npmrc\"];\n\nconst AUDIT = Arr.join(\n [\n 'copy=\"$(mktemp -d)\"',\n `trap 'rm -rf \"$copy\"' EXIT`,\n `for file in ${Arr.join(AUDIT_FILES, \" \")}; do if [ -f \"$file\" ]; then cp \"$file\" \"$copy/\"; fi; done`,\n '(cd \"$copy\" && vp pm audit --fix >/dev/null) || exit',\n `added=\"$(diff pnpm-workspace.yaml \"$copy/pnpm-workspace.yaml\" | sed -n 's/^> \\\\(.*\\\\)$/\\\\1 # exit: unused/p')\"`,\n 'if [ -z \"$added\" ]; then exit 0; fi',\n `printf '%s\\\\n' \"vp pm audit --fix found vulnerable versions. First update them within their ranges with vp update -r --no-save <package>... -- --depth Infinity. For each one still reported by vp pm audit, add its line to overrides in pnpm-workspace.yaml and run vp install:\" \"$added\" >&2`,\n \"exit 1\",\n ],\n \"; \",\n);\n\nconst BROKER_TOKEN = `GH_TOKEN=\"\\${GITHUB_APP_TOKEN:-$GH_TOKEN}\"`;\nconst AGENT_STATE = `\"\\${RUNNER_TEMP:-\\${TMPDIR:-/tmp}}/msch-agents\"`;\n\nconst DAILY = `msch exits; ${BROKER_TOKEN} msch upstream; ${BROKER_TOKEN} msch callers; ${BROKER_TOKEN} msch refs; refs=$?; msch agents ${AGENT_STATE} && exit \"$refs\"`;\n\nconst TEST = \"msch changed -- vp test run --passWithNoTests\";\n\nconst CARGO =\n \"cargo fmt --all --check && cargo clippy --workspace --all-targets --locked -- -D warnings\";\n\nconst cargoTasks = (cargo: Option.Option<CargoInputs>): Tasks =>\n Option.match(cargo, {\n onNone: (): Tasks => ({}),\n onSome: (inputs): Tasks => ({\n cargo: {\n command: CARGO,\n cache: { input: [...inputs], output: [], untrackedEnv: UNTRACKED_ENV },\n },\n }),\n });\n\nexport const MSCH_VERIFY_COMMANDS = {\n fallow: FALLOW,\n check: CHECK,\n msch: \"msch\",\n audit: AUDIT,\n published: \"msch published\",\n compat: COMPAT,\n skills: SKILLS,\n} as const;\n\nexport const MSCH_TASK_COMMANDS = { ...MSCH_VERIFY_COMMANDS, test: TEST } as const;\n\nexport const CI_TASKS = [TASK_NAMES.verify, TASK_NAMES.test] as const;\n\nconst USAGE_TASK = \"usage\";\n\nconst METERED_TASKS = [\"check\", \"msch\"] as const;\n\nexport const meteredCommand = (command: string): string =>\n `USAGE_METER_SPOOL=\"$PWD/${USAGE_SPOOL}\" ${command}`;\n\nconst usageCommandOf = ({ endpoint, apiKeyEnv }: UsageOptions): string =>\n pipe(\n Option.fromUndefinedOr(apiKeyEnv),\n Option.match({\n onNone: () => `msch usage --endpoint ${endpoint}`,\n onSome: (name) => `msch usage --endpoint ${endpoint} --api-key-env ${name}`,\n }),\n );\n\nconst commandOf =\n (usage: Option.Option<UsageOptions>) =>\n (command: string): string =>\n Option.match(usage, { onNone: () => command, onSome: () => meteredCommand(command) });\n\nconst usageTasks = (usage: Option.Option<UsageOptions>): Tasks =>\n Option.match(usage, {\n onNone: (): Tasks => ({}),\n onSome: (options): Tasks => ({\n [USAGE_TASK]: {\n command: usageCommandOf(options),\n dependsOn: [...METERED_TASKS],\n cache: false,\n },\n }),\n });\n\nexport const tasksOf = ({\n workspace,\n commands,\n usage,\n cargo,\n}: TaskOptions): NonNullable<NonNullable<UserConfig[\"run\"]>[\"tasks\"]> => {\n const inputs = [{ auto: true }, ...workspace.ignoredDirectories, ...NOT_INPUTS];\n const run = commandOf(usage);\n const checks: Tasks = {\n ...commands,\n fallow: {\n command: FALLOW,\n cache: {\n input: [...inputs, \"!.fallow/**\", \"!**/dist/**\", \"!**/.fallow-verified\"],\n output: [],\n },\n },\n check: {\n command: run(CHECK),\n cache: { input: inputs, untrackedEnv: UNTRACKED_ENV },\n },\n msch: {\n command: run(MSCH_VERIFY_COMMANDS.msch),\n dependsOn: [\"check\", ...workspace.tasks.native],\n cache: false,\n },\n audit: { command: AUDIT, cache: false },\n skills: { command: SKILLS, cache: { input: inputs, output: [] } },\n published: { command: MSCH_TASK_COMMANDS.published, cache: false },\n compat: { command: COMPAT, dependsOn: [\"msch\", \"fallow\"], cache: false },\n ...cargoTasks(cargo),\n ...usageTasks(usage),\n };\n return {\n ...checks,\n test: {\n command: TEST,\n dependsOn: [\"check\", ...workspace.tasks.native],\n cache: { input: [...inputs, \"!**/.cache/**\"] },\n },\n daily: { command: DAILY, dependsOn: [...workspace.tasks.native], cache: false },\n verify: { command: [], dependsOn: [...workspace.tasks.verify, ...Rec.keys(checks)] },\n ci: { command: [], dependsOn: [...CI_TASKS, ...workspace.tasks.test] },\n };\n};\n\nconst REINSTALL = \"vp install\";\n\nexport const GIT_HOOKS = {\n \"pre-commit\": [\"vp staged\", \"vp exec msch --staged\"],\n \"commit-msg\": ['vp exec msch --commit-msg \"$1\"'],\n \"pre-push\": [\"vp exec msch --pre-push\", \"vp run verify\"],\n \"post-checkout\": [`[ \"$3\" = 0 ] || ${REINSTALL}`],\n \"post-merge\": [REINSTALL],\n \"post-rewrite\": [REINSTALL],\n} as const satisfies GitHooksSection;\n\nexport const gitHooksOf = (hooks: GitHooksSection = {}): GitHooksSection => ({\n ...GIT_HOOKS,\n ...hooks,\n});\n","import type { H56mConfig } from \"@r_masseater/h56m\";\nimport { betterleaks } from \"@r_masseater/h56m/presets\";\nimport type { ToolSections } from \"@r_masseater/vite-plus-adopt\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport {\n textlintFilters,\n textlintPresets,\n zennMarkdown,\n} from \"#/features/define-lint-preset/index.ts\";\nimport { exempt } from \"#/shared/config/index.ts\";\n\ntype Source = NonNullable<NonNullable<ToolSections[\"textlint\"]>[\"sources\"]>[number];\n\nexport interface TextSource {\n readonly files: readonly string[];\n readonly plugins: Readonly<Record<string, boolean | object>>;\n}\n\nexport interface TextOptions {\n readonly properNouns?: readonly string[];\n readonly rules?: Readonly<Record<string, object>>;\n readonly sources?: readonly TextSource[];\n}\n\nexport interface BuiltTextOptions extends TextOptions {\n readonly articles: readonly string[];\n}\n\nexport const TEXT_IGNORES = [\n \"AGENTS.md\",\n \"CLAUDE.md\",\n \".agents/skills/**\",\n \"CHANGELOG.md\",\n ...exempt,\n];\nconst ZENN_MARKDOWN = \"zenn-markdown\";\nconst QUOTATION = String.raw`/「(?:[^「」]|「[^「」]*」)*」|『(?:[^『』]|『[^『』]*』)*』/`;\nconst SPEAKER = String.raw`/^:::[\\w-]+\\n[\\s\\S]*?\\n:::$/m`;\nconst ELLIPSIS = \"…\";\n\n/** @internal */\nexport const BUILT_ALLOWANCES: readonly string[] = [QUOTATION, SPEAKER];\nconst filtersOf = (properNouns: readonly string[]): Readonly<Record<string, object | boolean>> => ({\n comments: true,\n \"node-types\": { nodeTypes: [\"BlockQuote\"] },\n allowlist: { allow: [...BUILT_ALLOWANCES, ...properNouns] },\n});\nconst SENTENCE_LENGTH = 120;\nconst KANJI_RUN = 6;\nconst PUBLIC_LINES = [\n String.raw`\\bCF_BEACON_TOKEN = \"[0-9a-f]{32}\"`,\n String.raw`\\b\\w*DISCORD_\\w*ID = \"[0-9]{17,20}\"`,\n String.raw`untrusted comment: minisign public key: [0-9A-F]{16}`,\n];\nconst EXEMPT_PATHS = [String.raw`(?:^|/)(?:fixtures|upstream|hooks/vendor)/`];\n\ntype Style = \"である\" | \"ですます\";\n\nconst builtRules = (style: Style): Readonly<Record<string, boolean | object>> => ({\n \"@textlint-ja/preset-ai-writing\": true,\n \"@r_masseater/preset-ja\": true,\n \"preset-ja-technical-writing\": {\n \"sentence-length\": { max: SENTENCE_LENGTH },\n \"ja-no-mixed-period\": { allowPeriodMarks: [\":\"] },\n \"no-mix-dearu-desumasu\": { preferInBody: style, preferInList: style },\n \"max-kanji-continuous-len\": { max: KANJI_RUN },\n \"ja-no-successive-word\": { allow: [ELLIPSIS] },\n },\n});\n\nexport const textlintOf = ({\n properNouns = [],\n rules = {},\n sources = [],\n articles,\n}: BuiltTextOptions): NonNullable<ToolSections[\"textlint\"]> => {\n const textRules = { ...rules, ...builtRules(\"である\") };\n const filters = filtersOf(properNouns);\n const articleSources = Arr.filter(\n [\n {\n files: [...articles],\n plugins: { [ZENN_MARKDOWN]: true },\n rules: { ...rules, ...builtRules(\"ですます\") },\n filters,\n } satisfies Source,\n ],\n () => Arr.isReadonlyArrayNonEmpty(articles),\n );\n return {\n ignores: [...TEXT_IGNORES, ...articles],\n presets: textlintPresets,\n filterModules: textlintFilters,\n pluginModules: { [ZENN_MARKDOWN]: zennMarkdown },\n reportUnusedDirectives: true,\n sources: pipe(\n sources,\n Arr.map(({ files, plugins }): Source => ({\n files: [...files],\n plugins: { ...plugins },\n rules: textRules,\n filters,\n })),\n Arr.appendAll(articleSources),\n ),\n filters,\n rules: textRules,\n };\n};\n\nconst anyOf =\n (subject: string) =>\n (patterns: readonly string[]): readonly string[] => {\n if (Arr.isReadonlyArrayEmpty(patterns)) {\n return [];\n }\n const listed = pipe(\n patterns,\n Arr.map((pattern) => `\\`${pattern}\\``),\n Arr.join(\", \"),\n );\n return [`matchesAny(${subject}, [${listed}])`];\n };\n\nexport const secretsOf = (): H56mConfig => ({\n extend: { path: betterleaks },\n filter: pipe(\n [...anyOf(\"finding.line\")(PUBLIC_LINES), ...anyOf(`attributes[\"path\"]`)(EXEMP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U,UAAU,WAAW;CACrC,MAAM,iBAAiBC,MAAI,OACzB,CACE;EACE,OAAO,CAAC,GAAG,QAAQ;EACnB,SAAS,GAAG,gBAAgB,KAAK;EACjC,OAAO;GAAE,GAAG;GAAO,GAAG,WAAW,MAAM;EAAE;EACzC;CACF,CACF,SACMA,MAAI,wBAAwB,QAAQ,CAC5C;CACA,OAAO;EACL,SAAS,CAAC,GAAG,cAAc,GAAG,QAAQ;EACtC,SAAS;EACT,eAAe;EACf,eAAe,GAAG,gBAAgB,aAAa;EAC/C,wBAAwB;EACxB,SAAS,KACP,SACAA,MAAI,KAAK,EAAE,OAAO,eAAuB;GACvC,OAAO,CAAC,GAAG,KAAK;GAChB,SAAS,EAAE,GAAG,QAAQ;GACtB,OAAO;GACP;EACF,EAAE,GACFA,MAAI,UAAU,cAAc,CAC9B;EACA;EACA,OAAO;CACT;AACF;AAEA,MAAM,SACH,aACA,aAAmD;CAClD,IAAIA,MAAI,qBAAqB,QAAQ,GACnC,OAAO,CAAC;CAOV,OAAO,CAAC,cAAc,QAAQ,KALf,KACb,UACAA,MAAI,KAAK,YAAY,KAAK,QAAQ,GAAG,GACrCA,MAAI,KAAK,IAAI,CAEyB,EAAE,GAAG;AAC/C;AAEF,MAAa,mBAA+B;CAC1C,QAAQ,EAAE,MAAM,YAAY;CAC5B,QAAQ,KACN,CAAC,GAAG,MAAM,cAAc,CAAC,CAAC,YAAY,GAAG,GAAG,MAAM,oBAAoB,CAAC,CAAC,YAAY,CAAC,GACrFA,MAAI,KAAK,MAAM,CACjB;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type DependencyAllowance, type DependencySets, type IgnoredDirectory, type RuleSet, type RuleSets, type SettingsOptions, type WorkspaceLint, type WorkspaceSettings, type WorkspaceTasks, ignoredDirectories, workspaceSettings };
|
|
1
|
+
import { a as WorkspaceLint, c as DependencyAllowance, d as ignoredDirectories, f as WorkspaceTasks, i as SettingsOptions, l as DependencySets, n as RuleSet, o as WorkspaceSettings, r as RuleSets, s as workspaceSettings, t as AddedRulesValue, u as IgnoredDirectory } from "./index-C93QRE06.mjs";
|
|
2
|
+
export { type AddedRulesValue, type DependencyAllowance, type DependencySets, type IgnoredDirectory, type RuleSet, type RuleSets, type SettingsOptions, type WorkspaceLint, type WorkspaceSettings, type WorkspaceTasks, ignoredDirectories, workspaceSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/msch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.131.0",
|
|
4
4
|
"description": "A check policy for repositories: 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",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"imports": {
|
|
38
38
|
"#/*": "./src/*",
|
|
39
|
-
"#package.json": "./package.json"
|
|
39
|
+
"#package.json": "./package.json",
|
|
40
|
+
"#renovate.json": "./renovate.json"
|
|
40
41
|
},
|
|
41
42
|
"exports": {
|
|
42
43
|
"./cli": "./dist/cli.mjs",
|
|
@@ -62,7 +63,6 @@
|
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
65
|
"@commitlint/config-conventional": "^21.3.0",
|
|
65
|
-
"@commitlint/types": "^21.3.0",
|
|
66
66
|
"@html-eslint/eslint-plugin-react": "^0.69.0",
|
|
67
67
|
"@npmcli/package-json": "^8.0.1",
|
|
68
68
|
"@pnpm/deps.path": "^1101.0.11",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@anthropic-ai/claude-agent-sdk": "0.3.332",
|
|
108
|
+
"@commitlint/types": "21.3.0",
|
|
108
109
|
"@effect/platform-node": "4.2.0",
|
|
109
110
|
"@effect/platform-node-shared": "4.2.0",
|
|
110
111
|
"@effect/tsgo": "0.75.0",
|
|
@@ -126,6 +127,7 @@
|
|
|
126
127
|
},
|
|
127
128
|
"peerDependencies": {
|
|
128
129
|
"@anthropic-ai/claude-agent-sdk": ">=0.3.332",
|
|
130
|
+
"@commitlint/types": ">=21.3.0",
|
|
129
131
|
"@effect/platform-node": "^4.1.0",
|
|
130
132
|
"@effect/platform-node-shared": "^4.1.0",
|
|
131
133
|
"@effect/tsgo": ">=0.74.3",
|