@r_masseater/msch 0.95.0 → 0.97.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/{base-revision-uiUwYlbc.mjs → base-revision-Bl-4nxAd.mjs} +2 -2
- package/dist/{base-revision-uiUwYlbc.mjs.map → base-revision-Bl-4nxAd.mjs.map} +1 -1
- package/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +5 -5
- package/dist/cli.mjs +403 -196
- package/dist/cli.mjs.map +1 -1
- package/dist/config-BBdsNPSO.mjs.map +1 -1
- package/dist/config.d.mts +19 -16
- package/dist/config.mjs +23 -161
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-BjHY5WNt.mjs → define-lint-preset-B-hC9_df.mjs} +60 -45
- package/dist/define-lint-preset-B-hC9_df.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/{ignored-directories-BRRODOoG.mjs → ignored-directories-D-7Rm_2X.mjs} +2 -2
- package/dist/{ignored-directories-BRRODOoG.mjs.map → ignored-directories-D-7Rm_2X.mjs.map} +1 -1
- package/dist/{index-Bw2kfEek.d.mts → index-CEazCJ_w.d.mts} +38 -11
- package/dist/{index-CMyIrsah.d.mts → index-Dm0Gg9wS.d.mts} +2 -2
- package/dist/judge.mjs +4 -4
- package/dist/lint-rules.mjs +23 -11
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +2 -2
- package/dist/lint.mjs +1 -1
- package/dist/{lookup-report-BWiDFlSS.mjs → lookup-report-L5OLXRMf.mjs} +3 -3
- package/dist/{lookup-report-BWiDFlSS.mjs.map → lookup-report-L5OLXRMf.mjs.map} +1 -1
- package/dist/{manifest-texts-Bhlz2Z2_.mjs → manifest-texts-DPgsV8kj.mjs} +2 -2
- package/dist/{manifest-texts-Bhlz2Z2_.mjs.map → manifest-texts-DPgsV8kj.mjs.map} +1 -1
- package/dist/{output-B4GNchqH.mjs → output-DAvdel9H.mjs} +3 -3
- package/dist/{output-B4GNchqH.mjs.map → output-DAvdel9H.mjs.map} +1 -1
- package/dist/oxlint.mjs +2 -2
- package/dist/{package-routes-BdYpOLTv.mjs → package-routes-BQWX5ttU.mjs} +2 -2
- package/dist/{package-routes-BdYpOLTv.mjs.map → package-routes-BQWX5ttU.mjs.map} +1 -1
- package/dist/{package-versions-BLtKon6D.mjs → package-versions-sx15IGwA.mjs} +4 -4
- package/dist/{package-versions-BLtKon6D.mjs.map → package-versions-sx15IGwA.mjs.map} +1 -1
- package/dist/{pass-records-ljpQ--tm.mjs → pass-records-BcAAWgiQ.mjs} +4 -4
- package/dist/{pass-records-ljpQ--tm.mjs.map → pass-records-BcAAWgiQ.mjs.map} +1 -1
- package/dist/{problem-Bi4Kgg9b.mjs → problem-DbuTeNvL.mjs} +2 -2
- package/dist/{problem-Bi4Kgg9b.mjs.map → problem-DbuTeNvL.mjs.map} +1 -1
- package/dist/publish.mjs +1 -1
- package/dist/{published-BGur-Htr.mjs → published-3eokcs_D.mjs} +17 -3
- package/dist/published-3eokcs_D.mjs.map +1 -0
- package/dist/published.mjs +6 -6
- package/dist/refs.mjs +4 -5
- package/dist/refs.mjs.map +1 -1
- package/dist/{registry-releases-CaO-8xAO.mjs → registry-releases-BBtz4wGE.mjs} +2 -2
- package/dist/{registry-releases-CaO-8xAO.mjs.map → registry-releases-BBtz4wGE.mjs.map} +1 -1
- package/dist/{repository-files-hbJpQ1i0.mjs → repository-files-DSwKJnrj.mjs} +5 -4
- package/dist/repository-files-DSwKJnrj.mjs.map +1 -0
- package/dist/repository-text-DGfYd5Wq.mjs +178 -0
- package/dist/repository-text-DGfYd5Wq.mjs.map +1 -0
- package/dist/{runtime-BdEuIL6Z.mjs → runtime-Djm7zMwu.mjs} +2 -2
- package/dist/{runtime-BdEuIL6Z.mjs.map → runtime-Djm7zMwu.mjs.map} +1 -1
- package/dist/unbumped.mjs +5 -5
- package/dist/{upstream-exits-BC8ofnVa.mjs → upstream-exits-4bn4gblF.mjs} +5 -6
- package/dist/{upstream-exits-BC8ofnVa.mjs.map → upstream-exits-4bn4gblF.mjs.map} +1 -1
- package/dist/{upstream-record-I5ZgAwk-.mjs → upstream-record-DRNGym9S.mjs} +2 -3
- package/dist/{upstream-record-I5ZgAwk-.mjs.map → upstream-record-DRNGym9S.mjs.map} +1 -1
- package/dist/upstream.mjs +6 -6
- package/dist/{workspace-projects-DnWDM8G1.mjs → workspace-projects-MpL8K7Nz.mjs} +2 -2
- package/dist/{workspace-projects-DnWDM8G1.mjs.map → workspace-projects-MpL8K7Nz.mjs.map} +1 -1
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +50 -31
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +10 -10
- package/skills/msch-publishing/SKILL.md +1 -1
- package/skills/msch-repository-config/SKILL.md +19 -8
- package/skills/msch-workspace-settings/SKILL.md +8 -10
- package/src/app/vite.d.ts +3 -3
- package/dist/collections-CdEHfcEj.mjs +0 -6
- package/dist/collections-CdEHfcEj.mjs.map +0 -1
- package/dist/define-lint-preset-BjHY5WNt.mjs.map +0 -1
- package/dist/index-skill-Bf5Ish11.mjs +0 -19
- package/dist/index-skill-Bf5Ish11.mjs.map +0 -1
- package/dist/published-BGur-Htr.mjs.map +0 -1
- package/dist/repository-files-hbJpQ1i0.mjs.map +0 -1
package/dist/publish.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runCli } from "./runtime-
|
|
2
|
+
import { t as runCli } from "./runtime-Djm7zMwu.mjs";
|
|
3
3
|
import { n as PUBLIC_REGISTRY } from "./registries-DePiYd3D.mjs";
|
|
4
4
|
import { Array, Config, Console, Effect, FileSystem, Option, Order, Path, Predicate, Record, Schedule, Schema, Stdio, String as String$1, pipe } from "effect";
|
|
5
5
|
import { PACKAGE_JSON_FILE, ROOT_SUBPATH, exportEntriesOf, importSpecifierOf, runtimeDependencyNames, unscopedNameOf } from "@r_masseater/masseater-utils/kestrion";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { r as RepositoryFiles } from "./repository-files-
|
|
1
|
+
import { r as RepositoryFiles, s as groupOf } from "./repository-files-DSwKJnrj.mjs";
|
|
2
2
|
import { t as baseName } from "./path-DUttmo2s.mjs";
|
|
3
3
|
import { Array, Effect, Match, Option, Predicate, Record, Schema, String, pipe } from "effect";
|
|
4
4
|
import { readWantedLockfile } from "@r_masseater/masseater-utils/kestrion/pnpm";
|
|
5
5
|
import { PACKAGE_JSON_FILE, binEntriesOf, exportEntriesOf, targetsIn } from "@r_masseater/masseater-utils/kestrion";
|
|
6
6
|
import { decodePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
|
|
7
7
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
8
|
+
import { parse as parse$1 } from "yaml";
|
|
8
9
|
// src/entities/workspace/model/config-literal.ts
|
|
9
10
|
const WRAPPERS = [
|
|
10
11
|
"TSAsExpression",
|
|
@@ -306,6 +307,19 @@ const workspaceLinks = Effect.fn("workspaceLinks")(function* workspaceLinks(root
|
|
|
306
307
|
project.optionalDependencies
|
|
307
308
|
]))))), Option.getOrElse(() => []));
|
|
308
309
|
});
|
|
310
|
+
// src/shared/lib/frontmatter.ts
|
|
311
|
+
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
312
|
+
const START = 0;
|
|
313
|
+
const Fields = Schema.Record(Schema.String, Schema.Unknown);
|
|
314
|
+
const decodeFields = Schema.decodeUnknownOption(Fields);
|
|
315
|
+
const splitFrontmatter = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.flatMap((found) => pipe(groupOf("yaml")(found), Option.flatMap(Option.liftThrowable((yaml) => parse$1(yaml))), Option.flatMap(decodeFields), Option.map((fields) => ({
|
|
316
|
+
fields,
|
|
317
|
+
body: String.slice(found[START].length)(source)
|
|
318
|
+
})))));
|
|
319
|
+
// src/shared/lib/index-skill.ts
|
|
320
|
+
const INDEX_ROLE = "index";
|
|
321
|
+
/** @internal */
|
|
322
|
+
const isIndexSkill = ({ fields }) => Predicate.isObject(fields["metadata"]) && Predicate.hasProperty(fields["metadata"], "role") && fields["metadata"].role === INDEX_ROLE;
|
|
309
323
|
// src/entities/package/model/public-entries.ts
|
|
310
324
|
const SOURCE = /\.[cm]?tsx?$/u;
|
|
311
325
|
const BUILT = /\.(?:d\.)?[cm]?[jt]s$/u;
|
|
@@ -440,6 +454,6 @@ const publishedWorkspaces = Effect.fn("publishedWorkspaces")(function* published
|
|
|
440
454
|
...budgetOf(budget)
|
|
441
455
|
})), Option.toArray)));
|
|
442
456
|
});
|
|
443
|
-
export {
|
|
457
|
+
export { usedFrom as A, hasVerifyTask as C, merged as D, literalSettings as E, literalOf as F, nestedValues as I, propertyValue as L, KeySchema as M, childrenOf as N, programOf as O, keyName as P, stringsIn as R, definesTask as S, testsItself as T, shadcnUiOf as _, workspaceConfigs as a, RUN_TASKS as b, publicEntriesOf as c, splitFrontmatter as d, linkedPaths as f, shadcnUiIn as g, deployEntries as h, publishedWorkspaces as i, workspaceConfigOf as j, settingsInvalid as k, isIndexSkill as l, bundledEntries as m, entriesOf as n, entryNameOf as o, workspaceLinks as p, packedWorkspaces as r, isBinEntry as s, PackEntry as t, FRONTMATTER as u, prefixed as v, tasksOf as w, VERIFY_TASK as x, NO_TASKS as y };
|
|
444
458
|
|
|
445
|
-
//# sourceMappingURL=published-
|
|
459
|
+
//# sourceMappingURL=published-3eokcs_D.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-3eokcs_D.mjs","names":["Arr","Rec","CONFIG_FILE","taggedError","Arr","Rec","Arr","SEPARATOR","Str","Str","Rec","Arr","READ_CONCURRENCY","Arr","Arr","Rec","Str","parse","Str","Str","Arr","Arr","Str","Rec"],"sources":["../src/entities/workspace/model/config-literal.ts","../src/entities/workspace/model/workspace-config-source.ts","../src/entities/workspace/model/workspace-tasks.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/shadcn-ui.ts","../src/entities/workspace/model/deploy-entries.ts","../src/entities/workspace/model/locked-links.ts","../src/shared/lib/frontmatter.ts","../src/shared/lib/index-skill.ts","../src/entities/package/model/public-entries.ts","../src/entities/package/model/published.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nexport type Literal = string | number | boolean | null | readonly Literal[] | LiteralObject;\n\nexport interface LiteralObject {\n readonly [key: string]: Literal;\n}\n\nconst WRAPPERS = [\"TSAsExpression\", \"TSSatisfiesExpression\", \"ParenthesizedExpression\"] as const;\n\nexport const KeySchema = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"Literal\"), value: Schema.String }),\n]);\nconst Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });\nconst PropertyNode = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n});\nconst WrappedNode = Schema.Struct({ type: Schema.Literals(WRAPPERS), expression: Schema.Unknown });\nconst ValueNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"Literal\"),\n value: Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]),\n }),\n Schema.Struct({\n type: Schema.Literal(\"TemplateLiteral\"),\n expressions: Schema.Tuple([]),\n quasis: Schema.Array(Quasi),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ArrayExpression\"),\n elements: Schema.Array(Schema.Unknown),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(PropertyNode),\n }),\n]);\n\nconst decodeWrapped = Schema.decodeUnknownOption(WrappedNode);\nconst decodeValue = Schema.decodeUnknownOption(ValueNode);\nconst decodeProperty = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"Property\"), key: KeySchema, value: Schema.Unknown }),\n);\nconst decodeObject = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n);\n\nexport const keyName = (key: typeof KeySchema.Type): string =>\n Match.value(key).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Identifier: (identifier) => identifier.name,\n Literal: (literal) => literal.value,\n }),\n );\n\nexport const literalOf = (node: unknown): Option.Option<Literal> => {\n const wrapped = decodeWrapped(node);\n if (Option.isSome(wrapped)) {\n return literalOf(wrapped.value.expression);\n }\n return pipe(\n decodeValue(node),\n Option.flatMap((value) =>\n Match.value(value).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Literal: (scalar): Option.Option<Literal> => Option.some(scalar.value),\n TemplateLiteral: (template): Option.Option<Literal> =>\n Option.some(\n pipe(\n template.quasis,\n Arr.map((quasi) => quasi.value.cooked),\n Arr.join(\"\"),\n ),\n ),\n ArrayExpression: (array): Option.Option<Literal> =>\n pipe(array.elements, Arr.map(literalOf), Option.all),\n ObjectExpression: (object): Option.Option<Literal> =>\n pipe(\n object.properties,\n Arr.map((property) =>\n pipe(\n literalOf(property.value),\n Option.map((literal) => [keyName(property.key), literal] as const),\n ),\n ),\n Option.all,\n Option.map(Rec.fromEntries),\n ),\n }),\n ),\n ),\n );\n};\n\nexport const propertyValue =\n (name: string) =>\n (object: unknown): Option.Option<unknown> =>\n pipe(\n decodeObject(object),\n Option.flatMap(({ properties }) =>\n pipe(\n properties,\n Arr.findFirst((property) =>\n pipe(\n decodeProperty(property),\n Option.filter(({ key }) => keyName(key) === name),\n Option.map(({ value }) => value),\n ),\n ),\n ),\n ),\n );\n\nexport const childrenOf = (node: unknown): readonly unknown[] => {\n if (Arr.isArray(node)) {\n return node;\n }\n if (Predicate.isReadonlyObject(node)) {\n return Rec.values(node);\n }\n return [];\n};\n\nexport const nestedValues =\n (path: readonly [string, string]) =>\n (node: unknown): readonly unknown[] => {\n const [outer, inner] = path;\n const own = pipe(\n Option.some(node),\n Option.flatMap(propertyValue(outer)),\n Option.flatMap(propertyValue(inner)),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(nestedValues(path)))];\n };\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\nexport interface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nexport const stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { literalOf, nestedValues } from \"./config-literal.ts\";\n\nconst SINGLE = 1;\nconst CONFIG_FILE = \"vite.config.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceSettingsInvalid extends taggedError<\n WorkspaceSettingsInvalid,\n { readonly brand: unique symbol }\n>()(\"WorkspaceSettingsInvalid\", { file: Schema.String, message: Schema.String }) {}\n\nexport const settingsInvalid =\n (file: string) =>\n (reason: string): WorkspaceSettingsInvalid =>\n WorkspaceSettingsInvalid.make({ file, message: `${file}: ${reason}` });\n\nexport interface WorkspaceSource {\n readonly file: string;\n readonly directory: string;\n readonly program: unknown;\n}\n\nexport type SettingsPath = readonly [string, string];\n\nconst notLiteral = ([outer, inner]: SettingsPath): string =>\n `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Name a set the root config defines in use instead of importing values.`;\n\nexport const merged = <Value>(\n records: readonly Readonly<Record<string, Value>>[],\n): Record<string, Value> => pipe(records, Arr.flatMap(Rec.toEntries), Rec.fromEntries);\n\nexport const usedFrom = Effect.fn(\"usedFrom\")(function* usedFrom<Value>(\n file: string,\n sets: Readonly<Record<string, Value>>,\n used: readonly string[],\n) {\n const unknownSets = pipe(\n used,\n Arr.filter((name) => !Rec.has(sets, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(unknownSets)) {\n return yield* settingsInvalid(file)(\n `msch uses sets the root does not define: ${Arr.join(unknownSets, \", \")}. Defined: ${Arr.join(Rec.keys(sets), \", \")}.`,\n );\n }\n return pipe(\n used,\n Arr.flatMap((name) => Option.toArray(Rec.get(sets, name))),\n );\n});\n\nconst singleValue = Effect.fn(\"singleValue\")(function* singleValue(\n source: WorkspaceSource,\n path: SettingsPath,\n) {\n const found = nestedValues(path)(source.program);\n if (found.length > SINGLE) {\n return yield* settingsInvalid(source.file)(`${Arr.join(path, \".\")} appears more than once.`);\n }\n return Arr.head(found);\n});\n\nexport interface LiteralSettingsRequest<Settings> {\n readonly source: WorkspaceSource;\n readonly path: SettingsPath;\n readonly decode: (input: unknown) => Effect.Effect<Settings, Schema.SchemaError>;\n}\n\nexport const literalSettings = <Settings>({\n source,\n path,\n decode,\n}: LiteralSettingsRequest<Settings>): Effect.Effect<\n Option.Option<Settings>,\n WorkspaceSettingsInvalid\n> =>\n Effect.gen(function* literalSettingsIn() {\n const node = yield* singleValue(source, path);\n if (Option.isNone(node)) {\n return Option.none();\n }\n const literal = literalOf(node.value);\n if (Option.isNone(literal)) {\n return yield* settingsInvalid(source.file)(notLiteral(path));\n }\n const settings = yield* decode(literal.value).pipe(\n Effect.mapError((error) => settingsInvalid(source.file)(error.message)),\n );\n return Option.some(settings);\n });\n\nexport const programOf = Effect.fn(\"programOf\")(function* programOf(file: string, text: string) {\n const parsed = yield* Effect.promise(() => parse(file, text, { lang: \"ts\" }));\n if (Arr.isReadonlyArrayNonEmpty(parsed.errors)) {\n return yield* settingsInvalid(file)(\"vite.config.ts does not parse.\");\n }\n const program: unknown = parsed.program;\n return program;\n});\n\n/** @internal */\nexport interface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import type { PackageJson } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { nestedValues, propertyValue, stringsIn } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const VERIFY_TASK = [\"tasks\", \"verify\"] as const;\n\nexport const TEST_TASK = [\"tasks\", \"test\"] as const;\n\nconst NATIVE_TASK = [\"tasks\", \"native\"] as const;\n\nexport const RUN_TASKS = [\"run\", \"tasks\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n readonly native: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [], native: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nconst TEST_TASK_NAME = \"test\";\nconst DEPENDS_ON = \"dependsOn\";\n\nexport const testsItself = (program: unknown): boolean =>\n definesTask(TEST_TASK)(program) ||\n pipe(\n nestedValues(VERIFY_TASK)(program),\n Arr.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))),\n Arr.flatMap(stringsIn),\n Arr.some(({ text }) => text === TEST_TASK_NAME),\n );\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n return Option.exists(config, isVerified);\n});\n\nconst shipsAddon = (manifest: Option.Option<PackageJson>): boolean =>\n Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));\n\nexport const tasksOf =\n (manifest: Option.Option<PackageJson>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (name) => ({\n verify: Arr.getSomes([\n Option.liftPredicate(`${name}#verify`, () => definesTask(VERIFY_TASK)(program)),\n Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)),\n ]),\n native: Arr.filter(\n [`${name}#native`],\n () => definesTask(NATIVE_TASK)(program) || shipsAddon(manifest),\n ),\n }),\n }),\n );\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { prefixed, withoutRelative } from \"./workspace-patterns.ts\";\n\nconst SHADCN_FILE = \"components.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst decodeImports = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.String));\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\n\nconst withoutWildcard = Str.replace(WILDCARD, \"\");\n\nconst importTarget =\n (alias: string) =>\n ([key, target]: readonly [string, string]): Option.Option<string> => {\n if (!Str.endsWith(WILDCARD)(key)) {\n return Option.some(target).pipe(Option.filter(() => key === alias));\n }\n const prefix = withoutWildcard(key);\n if (!Str.startsWith(prefix)(alias)) {\n return Option.none();\n }\n return Option.some(`${withoutWildcard(target)}${Str.slice(prefix.length)(alias)}`);\n };\n\nconst resolvedAlias = (\n imports: Readonly<Record<string, string>>,\n alias: string,\n): Option.Option<string> =>\n pipe(Rec.toEntries(imports), Arr.findFirst(importTarget(alias)), Option.map(withoutRelative));\n\nexport type ShadcnUi = Readonly<{\n file: string;\n alias: string;\n target: Option.Option<string>;\n}>;\n\nexport const shadcnUiOf = Effect.fn(\"shadcnUiOf\")(function* shadcnUiOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SHADCN_FILE);\n const configText = yield* files.readFile(file);\n const manifestText = yield* files.readFile(files.join(root, directory, PACKAGE_JSON_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodePackageJson),\n Option.flatMap((manifest) => decodeImports(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }): ShadcnUi => ({\n file,\n alias: aliases.ui,\n target: pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n ),\n })),\n );\n});\n\nexport const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(\n root: string,\n directory: string,\n) {\n const found = yield* shadcnUiOf(root, directory);\n return pipe(\n found,\n Option.map(\n ({ alias, target }) =>\n `${prefixed(directory)(Option.getOrElse(target, () => alias))}${EVERYTHING}`,\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { KeySchema, childrenOf, keyName, stringsIn } from \"./config-literal.ts\";\n\nconst MAIN_KEY = \"main\";\nconst FRAMEWORK_SITES = \"Website\";\nconst READ_CONCURRENCY = 16;\nconst SCRIPT = /\\.[cm]?tsx?$/u;\nconst SKIPPED = /\\.test\\.|\\.d\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst MAIN_PROPERTY = /\\bmain\\s*:/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\nconst SiteNamespace = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(FRAMEWORK_SITES),\n});\nconst SiteResource = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n object: SiteNamespace,\n});\nconst FrameworkSite = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: SiteResource,\n});\nconst decodeFrameworkSite = Schema.decodeUnknownOption(FrameworkSite);\n\nconst isMainProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => keyName(key) === MAIN_KEY),\n );\n\ntype Skip = (node: unknown) => boolean;\n\nconst skipNothing: Skip = () => false;\n\nconst isFrameworkSite: Skip = (node) => Option.isSome(decodeFrameworkSite(node));\n\nconst mainTargetsIn = (skip: Skip): ((node: unknown) => readonly string[]) => {\n const visit = (node: unknown): readonly string[] => {\n if (skip(node)) {\n return [];\n }\n if (Predicate.isReadonlyObject(node) && isMainProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.head,\n Option.map(({ text }) => text),\n Option.toArray,\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(visit));\n };\n return visit;\n};\n\ninterface Declaring {\n readonly root: string;\n readonly file: string;\n readonly skip: Skip;\n}\n\nconst declaredIn = Effect.fn(\"declaredIn\")(function* declaredIn({ root, file, skip }: Declaring) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value) || !MAIN_PROPERTY.test(text.value)) {\n return [];\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return pipe(\n mainTargetsIn(skip)(parsed.program),\n Arr.map((target) => files.join(files.dirname(file), target)),\n );\n});\n\nconst entriesOutside = Effect.fn(\"entriesOutside\")(function* entriesOutside(\n root: string,\n skip: Skip,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const declaring = pipe(\n listed,\n Arr.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)),\n );\n const found = yield* Effect.forEach(declaring, (file) => declaredIn({ root, file, skip }), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(\n Arr.flatten(found),\n Arr.filter((file) => Arr.contains(listed, file)),\n Arr.dedupe,\n );\n});\n\nexport const deployEntries = Effect.fn(\"deployEntries\")(function* deployEntries(root: string) {\n return yield* entriesOutside(root, skipNothing);\n});\n\nexport const bundledEntries = Effect.fn(\"bundledEntries\")(function* bundledEntries(root: string) {\n return yield* entriesOutside(root, isFrameworkSite);\n});\n","import { readWantedLockfile } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport type { ResolvedDependencies } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst LINK = \"link:\";\n\nexport interface WorkspaceLink {\n readonly from: string;\n readonly to: string;\n}\n\nexport const linkedPaths = (\n sections: readonly (ResolvedDependencies | undefined)[],\n): readonly string[] =>\n pipe(\n sections,\n Arr.flatMap((resolved) => Rec.values(resolved ?? {})),\n Arr.filter(Str.startsWith(LINK)),\n Arr.map((reference) => Str.slice(LINK.length)(reference)),\n );\n\n/** @internal */\nexport const workspaceLinks = Effect.fn(\"workspaceLinks\")(function* workspaceLinks(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* readWantedLockfile(root);\n const linksOf = (id: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const from = files.relative(root, files.join(root, id));\n return pipe(\n paths,\n Arr.map((path): WorkspaceLink => ({\n from,\n to: files.relative(root, files.join(root, id, path)),\n })),\n );\n };\n return pipe(\n lockfile,\n Option.map(({ importers }) =>\n pipe(\n Rec.toEntries(importers),\n Arr.flatMap(([id, project]) =>\n linksOf(\n id,\n linkedPaths([\n project.dependencies,\n project.devDependencies,\n project.optionalDependencies,\n ]),\n ),\n ),\n ),\n ),\n Option.getOrElse((): readonly WorkspaceLink[] => []),\n );\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nexport const FRONTMATTER = /^---\\n(?<yaml>[\\s\\S]*?)\\n---\\n/u;\n\nconst START = 0;\nconst Fields = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeFields = Schema.decodeUnknownOption(Fields);\n\nexport interface Frontmatter {\n readonly fields: typeof Fields.Type;\n readonly body: string;\n}\n\nexport const splitFrontmatter = (source: string): Option.Option<Frontmatter> =>\n pipe(\n Option.fromNullishOr(FRONTMATTER.exec(source)),\n Option.flatMap((found) =>\n pipe(\n groupOf(\"yaml\")(found),\n Option.flatMap(Option.liftThrowable((yaml: string): unknown => parse(yaml))),\n Option.flatMap(decodeFields),\n Option.map((fields): Frontmatter => ({\n fields,\n body: Str.slice(found[START].length)(source),\n })),\n ),\n ),\n );\n","import { Predicate } from \"effect\";\n\nimport type { Frontmatter } from \"./frontmatter.ts\";\n\nconst INDEX_ROLE = \"index\";\n\n/** @internal */\nexport const isIndexSkill = ({ fields }: Frontmatter): boolean =>\n Predicate.isObject(fields[\"metadata\"]) &&\n Predicate.hasProperty(fields[\"metadata\"], \"role\") &&\n fields[\"metadata\"].role === INDEX_ROLE;\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { binEntriesOf, exportEntriesOf, targetsIn } from \"@r_masseater/masseater-utils/kestrion\";\nimport type { PackageJson } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst DECLARATION = \".d.\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport type EntryManifest = Pick<PackageJson, \"name\" | \"exports\" | \"bin\">;\n\nexport interface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nexport const isBinEntry = ({ label }: PublicEntry): boolean =>\n Str.startsWith(`${BIN_LABEL} `)(label);\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] =>\n pipe(\n binEntriesOf(manifest),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n\nexport const entryNameOf = (target: string): string => Str.replace(BUILT, \"\")(baseName(target));\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = entryNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nexport const publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...exportEntriesOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nexport const PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst AlwaysBundle = Schema.Array(Schema.String);\nconst PackDeps = Schema.Struct({ alwaysBundle: Schema.optional(AlwaysBundle) });\nconst PackSettings = Schema.Struct({\n entry: Schema.optional(PackEntry),\n deps: Schema.optional(PackDeps),\n});\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst PackConfig = Schema.Struct({ pack: Schema.optional(PackList) });\nconst BudgetConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n});\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nexport interface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\nexport interface PackedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly packEntries: readonly PackEntrySource[];\n readonly alwaysBundle: readonly string[];\n}\n\nexport interface PublishedWorkspace extends PackedWorkspace {\n readonly installSize: string;\n readonly installBudget: number;\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nexport const entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packSettingsOf = (pack: typeof PackConfig.Type.pack): readonly (typeof PackSettings.Type)[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n );\n\nconst packEntriesOf = (pack: typeof PackConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst alwaysBundleOf = (pack: typeof PackConfig.Type.pack): readonly string[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.deps),\n Option.flatMap((deps) => Option.fromUndefinedOr(deps.alwaysBundle)),\n Option.getOrElse((): readonly string[] => []),\n ),\n ),\n Arr.dedupe,\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return config;\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));\n return pipe(\n text,\n Option.flatMap(decodePackageJson),\n Option.exists((manifest) => manifest.private !== true),\n );\n});\n\nconst packedWorkspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ pack }: typeof PackConfig.Type): PackedWorkspace => ({\n directory,\n configFile,\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n alwaysBundle: alwaysBundleOf(pack),\n });\n\nconst budgetOf = ({\n msch,\n}: typeof BudgetConfig.Type): Pick<PublishedWorkspace, \"installSize\" | \"installBudget\"> => {\n const [amount, , unit] = msch.publish.installSize;\n return { installSize: `${amount} ${unit}`, installBudget: amount * bytesPer(unit) };\n};\n\nconst packedIn = Effect.fn(\"packedIn\")(function* packedIn(root: string, configName: string) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<readonly [PackedWorkspace, unknown]>();\n }\n const config = yield* settingsIn(configFile);\n return pipe(\n config,\n Option.flatMap((found) =>\n pipe(\n Schema.decodeUnknownOption(PackConfig)(found),\n Option.map(\n packedWorkspaceOf(directory, configFile, (source) => files.join(directory, source)),\n ),\n Option.map((workspace) => [workspace, found] as const),\n ),\n ),\n );\n});\n\n/** @internal */\nexport const workspaceConfigs = Effect.fn(\"workspaceConfigs\")(function* workspaceConfigs(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n});\n\nconst packedPairs = Effect.fn(\"packedPairs\")(function* packedPairs(root: string) {\n const configs = yield* workspaceConfigs(root);\n const found = yield* Effect.forEach(configs, (name) => packedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\n/** @internal */\nexport const packedWorkspaces = Effect.fn(\"packedWorkspaces\")(function* packedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.map(([workspace]) => workspace),\n );\n});\n\n/** @internal */\nexport const publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.flatMap(([workspace, config]) =>\n pipe(\n Schema.decodeUnknownOption(BudgetConfig)(config),\n Option.map((budget): PublishedWorkspace => ({ ...workspace, ...budgetOf(budget) })),\n Option.toArray,\n ),\n ),\n );\n});\n"],"mappings":";;;;;;;;;AASA,MAAM,WAAW;CAAC;CAAkB;CAAyB;AAAyB;AAEtF,MAAa,YAAY,OAAO,MAAM,CACpC,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,YAAY;CAAG,MAAM,OAAO;AAAO,CAAC,GACzE,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,SAAS;CAAG,OAAO,OAAO;AAAO,CA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;AACF,CAAC;;AAGD,MAAa,sBAAsB,OAAO,GAAG,qBAAqB,CAAC,CAAC,UAAU,oBAC5E,MACA;CACA,MAAM,QAAQ,OAAO,YAAY,IAAI;CACrC,OAAO,KACL,OACAA,MAAI,SAAS,CAAC,WAAW,YACvB,KACE,OAAO,oBAAoB,YAAY,CAAC,CAAC,MAAM,GAC/C,OAAO,KAAK,YAAgC;EAAE,GAAG;EAAW,GAAG,SAAS,MAAM;CAAE,EAAE,GAClF,OAAO,OACT,CACF,CACF;AACF,CAAC"}
|
package/dist/published.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
3
|
-
import { t as runCli } from "./runtime-
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-L5OLXRMf.mjs";
|
|
3
|
+
import { t as runCli } from "./runtime-Djm7zMwu.mjs";
|
|
4
4
|
import { i as namedCatalogsOf, s as specifiedIn, t as fieldsOf } from "./specifiers-BrCyPubD.mjs";
|
|
5
5
|
import { t as workspaceManifest } from "./workspace-manifest-BAVyPzbA.mjs";
|
|
6
|
-
import { t as baseName } from "./base-revision-
|
|
7
|
-
import { t as manifestTexts } from "./manifest-texts-
|
|
8
|
-
import { a as packageRoutes, n as abbreviatedPackument, r as isOwnPackage } from "./package-routes-
|
|
9
|
-
import { r as RepositoryFiles } from "./repository-files-
|
|
6
|
+
import { t as baseName } from "./base-revision-Bl-4nxAd.mjs";
|
|
7
|
+
import { t as manifestTexts } from "./manifest-texts-DPgsV8kj.mjs";
|
|
8
|
+
import { a as packageRoutes, n as abbreviatedPackument, r as isOwnPackage } from "./package-routes-BQWX5ttU.mjs";
|
|
9
|
+
import { r as RepositoryFiles } from "./repository-files-DSwKJnrj.mjs";
|
|
10
10
|
import { Array, Clock, Effect, HashMap, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
11
11
|
import { decodePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
|
|
12
12
|
import semver from "semver";
|
package/dist/refs.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as lookupReport } from "./lookup-report-
|
|
3
|
-
import { t as runCli } from "./runtime-
|
|
4
|
-
import { r as RepositoryFiles } from "./repository-files-
|
|
5
|
-
import { c as jsonLookup, s as githubToken, t as abbreviatedLookup, u as sent } from "./package-routes-
|
|
6
|
-
import { t as groupOf } from "./collections-CdEHfcEj.mjs";
|
|
2
|
+
import { t as lookupReport } from "./lookup-report-L5OLXRMf.mjs";
|
|
3
|
+
import { t as runCli } from "./runtime-Djm7zMwu.mjs";
|
|
4
|
+
import { r as RepositoryFiles, s as groupOf } from "./repository-files-DSwKJnrj.mjs";
|
|
5
|
+
import { c as jsonLookup, s as githubToken, t as abbreviatedLookup, u as sent } from "./package-routes-BQWX5ttU.mjs";
|
|
7
6
|
import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
|
|
8
7
|
import { Array, Effect, HashMap, HashSet, Match, Option, Record, Schema, String as String$1, pipe } from "effect";
|
|
9
8
|
import { NO_PATH, describeReference, linksIn, referenceOf } from "@r_masseater/y8";
|
package/dist/refs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.mjs","names":["Arr","Str","SEPARATOR","Rec","Arr","Str","Arr","Arr"],"sources":["../src/features/check-references/model/markdown-texts.ts","../src/features/check-references/model/declared-symbols.ts","../src/features/check-references/model/resolve-reference.ts","../src/features/check-references/model/unresolved-references.ts","../bin/msch-refs.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst MARKDOWN = \".md\";\nconst FIXTURE = /(?:^|\\/)fixtures\\//u;\nconst READ_CONCURRENCY = 16;\n\n/** @internal */\nexport interface MarkdownText {\n readonly file: string;\n readonly source: string;\n}\n\n/** @internal */\nexport const markdownTexts = Effect.fn(\"markdownTexts\")(function* markdownTexts(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const documents = pipe(\n listed,\n Arr.filter((file) => Str.endsWith(MARKDOWN)(file) && !FIXTURE.test(file)),\n Arr.map((file) => files.join(root, file)),\n );\n const read = yield* Effect.forEach(\n documents,\n (file) =>\n Effect.map(\n files.readFile(file),\n Option.map((source): MarkdownText => ({ file, source })),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(read);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, HashSet, Option, Record as Rec, pipe } from \"effect\";\n\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { SyntaxNode } from \"#/shared/lib/tree-sitter.ts\";\n\nconst GRAMMAR_OF: Readonly<Record<string, string>> = {\n ts: \"typescript\",\n mts: \"typescript\",\n cts: \"typescript\",\n tsx: \"tsx\",\n js: \"javascript\",\n mjs: \"javascript\",\n cjs: \"javascript\",\n jsx: \"javascript\",\n rs: \"rust\",\n py: \"python\",\n go: \"go\",\n java: \"java\",\n rb: \"ruby\",\n php: \"php\",\n cs: \"c-sharp\",\n cpp: \"cpp\",\n};\nconst IMPLEMENTATION = \"impl_item\";\nconst NAME_FIELD = \"name\";\nconst TYPE_FIELD = \"type\";\nconst SEPARATOR = \".\";\nconst EXTENSION = /\\.(?<extension>[^./]+)$/u;\nconst FIRST = 0;\nconst ONE = 1;\n\nexport const supportedExtensions: readonly string[] = Rec.keys(GRAMMAR_OF);\n\nexport const grammarOf = (path: string): Option.Option<string> =>\n pipe(\n groupOf(\"extension\")(EXTENSION.exec(path)),\n Option.flatMap((extension) => Rec.get(GRAMMAR_OF, extension)),\n );\n\nconst implementedType = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.liftPredicate(node, ({ type }) => type === IMPLEMENTATION),\n Option.flatMap((implementation) =>\n Option.fromNullishOr(implementation.childForFieldName(TYPE_FIELD)),\n ),\n );\n\nconst nameNodeOf = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.fromNullishOr(node.childForFieldName(NAME_FIELD)),\n Option.orElse(() => implementedType(node)),\n );\n\nconst suffixesOf = (chain: readonly string[]): readonly string[] =>\n pipe(\n Arr.range(FIRST, chain.length - ONE),\n Arr.map((from) => Arr.join(Arr.drop(chain, from), SEPARATOR)),\n );\n\nconst childrenOf = (node: SyntaxNode): readonly SyntaxNode[] =>\n pipe(\n node.namedChildren,\n Arr.flatMap((child) => Option.toArray(Option.fromNullishOr(child))),\n );\n\nconst namesUnder = (node: SyntaxNode, enclosing: readonly string[]): readonly string[] => {\n const own = Option.map(nameNodeOf(node), ({ text }) => text);\n const chain = Option.match(own, {\n onNone: () => enclosing,\n onSome: (name) => [...enclosing, name],\n });\n const declared = Option.match(own, { onNone: () => [], onSome: () => suffixesOf(chain) });\n return [...declared, ...Arr.flatMap(childrenOf(node), (child) => namesUnder(child, chain))];\n};\n\nexport const declaredSymbols = Effect.fn(\"declaredSymbols\")(function* declaredSymbols(\n grammar: string,\n source: string,\n) {\n const language = yield* loadLanguage(grammar);\n return pipe(\n readTree({ language, source, read: (root) => HashSet.fromIterable(namesUnder(root, [])) }),\n Option.getOrElse(() => HashSet.empty<string>()),\n );\n});\n","import { NO_PATH } from \"@r_masseater/y8\";\nimport type { GithubReference, NpmReference, Reference } from \"@r_masseater/y8\";\nimport { Array as Arr, Effect, HashSet, Match, Option, Schema, String as Str, pipe } from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient, HttpClientError } from \"effect/http\";\n\nimport { githubToken, jsonLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport type { Lookup } from \"#/shared/lib/lookup.ts\";\nimport { abbreviatedLookup } from \"#/shared/lib/package-routes.ts\";\n\nimport { declaredSymbols, grammarOf, supportedExtensions } from \"./declared-symbols.ts\";\n\nconst GITHUB = \"https://api.github.com/repos/\";\nconst RAW = \"application/vnd.github.raw+json\";\nconst NOT_FOUND = 404;\nconst MULTIPLE_CHOICES = 300;\nconst SEPARATOR = \"/\";\nconst LATEST = \"latest\";\n\n/** @internal */\nexport type Outcome =\n | { readonly kind: \"found\" }\n | { readonly kind: \"broken\"; readonly reason: string }\n | { readonly kind: \"unchecked\"; readonly reason: string };\n\nconst found: Outcome = { kind: \"found\" };\nconst broken = (reason: string): Outcome => ({ kind: \"broken\", reason });\nconst unchecked = (reason: string): Outcome => ({ kind: \"unchecked\", reason });\n\nconst Repository = Schema.Struct({\n full_name: Schema.String,\n archived: Schema.Boolean,\n default_branch: Schema.String,\n});\nconst Version = Schema.Struct({ deprecated: Schema.optional(Schema.String) });\nconst Packument = Schema.Struct({\n \"dist-tags\": Schema.Record(Schema.String, Schema.String),\n versions: Schema.Record(Schema.String, Version),\n});\n\ntype Failure = HttpClientError.HttpClientError | Schema.SchemaError;\ntype Lookups = Effect.Effect<Outcome, Failure, HttpClient.HttpClient>;\n\nconst answered = (\n lookup: Lookup,\n missing: string,\n next: (response: HttpClientResponse.HttpClientResponse) => Lookups,\n): Lookups =>\n Effect.flatMap(sent(lookup), (response) => {\n if (response.status === NOT_FOUND) {\n return Effect.succeed(broken(missing));\n }\n if (response.status >= MULTIPLE_CHOICES) {\n return Effect.succeed(unchecked(`the lookup answered HTTP ${String(response.status)}`));\n }\n return next(response);\n });\n\nconst encodedPath = (path: string): string =>\n pipe(Str.split(path, SEPARATOR), Arr.map(encodeURIComponent), Arr.join(SEPARATOR));\n\nconst repositoryOutcome = (\n { owner, repo }: GithubReference,\n repository: typeof Repository.Type,\n): Outcome => {\n if (Str.toLowerCase(repository.full_name) !== Str.toLowerCase(`${owner}/${repo}`)) {\n return broken(`${owner}/${repo} has moved to ${repository.full_name}. Point at the new name.`);\n }\n if (repository.archived) {\n return broken(\n `${owner}/${repo} is archived. Point at the repository that replaced it, or drop the pointer.`,\n );\n }\n return found;\n};\n\nconst symbolOutcome = Effect.fn(\"symbolOutcome\")(function* symbolOutcome(\n { path }: GithubReference,\n symbol: string,\n source: string,\n) {\n const grammar = grammarOf(path);\n if (Option.isNone(grammar)) {\n return broken(\n `${path} is not a file msch can read symbols from. Drop #${symbol}, or point at a file with one of the extensions ${Arr.join(supportedExtensions, \", \")}.`,\n );\n }\n const declared = yield* Effect.option(declaredSymbols(grammar.value, source));\n return Option.match(declared, {\n onNone: () => unchecked(`the ${grammar.value} grammar could not read ${path}`),\n onSome: (names) => {\n if (HashSet.has(names, symbol)) {\n return found;\n }\n return broken(`${path} declares no ${symbol}. Fix the name or point at where it lives now.`);\n },\n });\n});\n\nconst repositoryContentsOutcome = (\n reference: GithubReference,\n repository: typeof Repository.Type,\n token: Option.Option<string>,\n): Lookups => {\n const checked = repositoryOutcome(reference, repository);\n if (checked.kind !== \"found\" || reference.path === NO_PATH) {\n return Effect.succeed(checked);\n }\n const branch = Option.getOrElse(reference.ref, () => repository.default_branch);\n const url = `${GITHUB}${reference.owner}/${reference.repo}/contents/${encodedPath(reference.path)}?ref=${encodeURIComponent(branch)}`;\n const missing = `${reference.path} does not exist on ${branch} of ${reference.owner}/${reference.repo}. Point at where it lives now.`;\n return Option.match(reference.symbol, {\n onNone: () => answered(jsonLookup({ url, token }), missing, () => Effect.succeed(found)),\n onSome: (symbol) =>\n answered({ url, token, accept: RAW }, missing, (response) =>\n response.text.pipe(Effect.flatMap((source) => symbolOutcome(reference, symbol, source))),\n ),\n });\n};\n\nconst githubOutcome = Effect.fn(\"githubOutcome\")(function* githubOutcome(\n reference: GithubReference,\n) {\n const token = yield* githubToken;\n const lookup = jsonLookup({ url: `${GITHUB}${reference.owner}/${reference.repo}`, token });\n const missing = `${reference.owner}/${reference.repo} does not exist, or the token in GH_TOKEN cannot read it.`;\n return yield* answered(lookup, missing, (response) =>\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Repository)(response), (repository) =>\n repositoryContentsOutcome(reference, repository, token),\n ),\n );\n});\n\nconst versionOf = (\n { \"dist-tags\": tags }: typeof Packument.Type,\n requested: Option.Option<string>,\n): Option.Option<string> =>\n Option.match(requested, {\n onNone: () => Option.fromNullishOr(tags[LATEST]),\n onSome: (asked) =>\n Option.some(Option.getOrElse(Option.fromNullishOr(tags[asked]), () => asked)),\n });\n\nconst versionOutcome = (\n { name, version }: NpmReference,\n packument: typeof Packument.Type,\n): Outcome =>\n Option.match(versionOf(packument, version), {\n onNone: () => broken(`${name} has no ${LATEST} tag.`),\n onSome: (resolved) =>\n Option.match(Option.fromNullishOr(packument.versions[resolved]), {\n onNone: () => broken(`${name}@${resolved} is not published on npm.`),\n onSome: ({ deprecated }) =>\n Option.match(Option.fromNullishOr(deprecated), {\n onNone: () => found,\n onSome: (message) => broken(`${name}@${resolved} is deprecated: ${message}`),\n }),\n }),\n });\n\nconst npmOutcome = (reference: NpmReference): Lookups =>\n answered(\n abbreviatedLookup(reference.name),\n `${reference.name} is not published on npm.`,\n (response) =>\n Effect.map(HttpClientResponse.schemaBodyJson(Packument)(response), (packument) =>\n versionOutcome(reference, packument),\n ),\n );\n\n/** @internal */\nexport const resolveReference = (\n reference: Reference,\n): Effect.Effect<Outcome, never, HttpClient.HttpClient> =>\n Match.value(reference).pipe(\n Match.discriminatorsExhaustive(\"kind\")({ github: githubOutcome, npm: npmOutcome }),\n Effect.match({\n onFailure: (failure) => unchecked(`the lookup failed: ${String(failure)}`),\n onSuccess: (outcome) => outcome,\n }),\n );\n","import { describeReference, linksIn, referenceOf } from \"@r_masseater/y8\";\nimport type { LinkAt, Reference } from \"@r_masseater/y8\";\nimport { Array as Arr, Effect, HashMap, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { markdownTexts } from \"./markdown-texts.ts\";\nimport { resolveReference } from \"./resolve-reference.ts\";\nimport type { Outcome } from \"./resolve-reference.ts\";\n\nconst LOOKUP_CONCURRENCY = 4;\n\n/** @internal */\nexport interface UnresolvedReference {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n readonly outcome: \"broken\" | \"unchecked\";\n readonly reason: string;\n}\n\ninterface Occurrence {\n readonly file: string;\n readonly line: number;\n readonly reference: Reference;\n}\n\nconst occurrencesIn = (links: readonly LinkAt[]): readonly Occurrence[] =>\n pipe(\n links,\n Arr.flatMap(({ path, line, destination }) =>\n pipe(\n referenceOf(destination),\n Option.map((reference): Occurrence => ({ file: path, line, reference })),\n Option.toArray,\n ),\n ),\n );\n\ninterface Place {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n}\n\nconst unresolvedAt =\n (place: Place) =>\n (outcome: Outcome): Option.Option<UnresolvedReference> => {\n if (outcome.kind === \"found\") {\n return Option.none();\n }\n return Option.some({ ...place, outcome: outcome.kind, reason: outcome.reason });\n };\n\nconst unresolvedOf =\n (outcomes: HashMap.HashMap<string, Outcome>) =>\n ({ file, line, reference }: Occurrence): readonly UnresolvedReference[] => {\n const described = describeReference(reference);\n return pipe(\n outcomes,\n HashMap.get(described),\n Option.flatMap(unresolvedAt({ file, line, reference: described })),\n Option.toArray,\n );\n };\n\n/** @internal */\nexport const unresolvedReferences = Effect.fn(\"unresolvedReferences\")(\n function* unresolvedReferences(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* markdownTexts(root);\n const links = yield* linksIn(\n pipe(\n texts,\n Arr.map(({ file, source }) => ({ path: files.relative(root, file), text: source })),\n ),\n );\n const occurrences = occurrencesIn(links);\n const distinct = pipe(\n occurrences,\n Arr.dedupeWith(\n (left, right) => describeReference(left.reference) === describeReference(right.reference),\n ),\n Arr.map(({ reference }) => reference),\n );\n const resolved = yield* Effect.forEach(\n distinct,\n (reference) =>\n Effect.map(\n resolveReference(reference),\n (outcome) => [describeReference(reference), outcome] as const,\n ),\n { concurrency: LOOKUP_CONCURRENCY },\n );\n const outcomes = HashMap.fromIterable(resolved);\n return pipe(occurrences, Arr.flatMap(unresolvedOf(outcomes)));\n },\n);\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { unresolvedReferences } from \"#/features/check-references/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n reference: Schema.String,\n outcome: Schema.Literals([\"broken\", \"unchecked\"]),\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst VERDICTS: Readonly<Record<RowType[\"outcome\"], string>> = {\n broken: \"is stale:\",\n unchecked: \"could not be checked:\",\n};\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.reference} ${VERDICTS[row.outcome]} ${row.reason}`;\n\nrunCli(\"msch-refs\")(lookupReport({ row: Row, rows: unresolvedReferences, describe: describeRow }));\n"],"mappings":";;;;;;;;;;;AAIA,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,mBAAmB;;AASzB,MAAa,gBAAgB,OAAO,GAAG,eAAe,CAAC,CAAC,UAAU,cAAc,MAAc;CAC5F,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,OAAO,MAAM,YAAY,IAAI;CAC5C,MAAM,YAAY,KAChB,QACAA,MAAI,QAAQ,SAASC,SAAI,SAAS,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,GACxED,MAAI,KAAK,SAAS,MAAM,KAAK,MAAM,IAAI,CAAC,CAC1C;CACA,MAAM,OAAO,OAAO,OAAO,QACzB,YACC,SACC,OAAO,IACL,MAAM,SAAS,IAAI,GACnB,OAAO,KAAK,YAA0B;EAAE;EAAM;CAAO,EAAE,CACzD,GACF,EAAE,aAAa,iBAAiB,CAClC;CACA,OAAOA,MAAI,SAAS,IAAI;AAC1B,CAAC;;AC3BD,MAAM,aAA+C;CACnD,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ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ACE,OACAA,MAAI,KAAK,EAAE,MAAM,cAAc;EAAE,MAAM,MAAM,SAAS,MAAM,IAAI;EAAG,MAAM;CAAO,EAAE,CACpF,CACF;CACA,MAAM,cAAc,cAAc,KAAK;CACvC,MAAM,WAAW,KACf,aACAA,MAAI,YACD,MAAM,UAAU,kBAAkB,KAAK,SAAS,MAAM,kBAAkB,MAAM,SAAS,CAC1F,GACAA,MAAI,KAAK,EAAE,gBAAgB,SAAS,CACtC;CACA,MAAM,WAAW,OAAO,OAAO,QAC7B,WACC,cACC,OAAO,IACL,iBAAiB,SAAS,IACzB,YAAY,CAAC,kBAAkB,SAAS,GAAG,OAAO,CACrD,GACF,EAAE,aAAa,mBAAmB,CACpC;CACA,MAAM,WAAW,QAAQ,aAAa,QAAQ;CAC9C,OAAO,KAAK,aAAaA,MAAI,QAAQ,aAAa,QAAQ,CAAC,CAAC;AAC9D,CACF;;AC1FA,MAAM,MAAM,OAAO,OAAO;CACxB,MAAM,OAAO;CACb,MAAM,OAAO;CACb,WAAW,OAAO;CAClB,SAAS,OAAO,SAAS,CAAC,UAAU,WAAW,CAAC;CAChD,QAAQ,OAAO;AACjB,CAAC;AAID,MAAM,WAAyD;CAC7D,QAAQ;CACR,WAAW;AACb;AAEA,MAAM,eAAe,QACnB,GAAG,IAAI,KAAK,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,IAAI,UAAU,GAAG,SAAS,IAAI,SAAS,GAAG,IAAI;AAEnF,OAAO,WAAW,CAAC,CAAC,aAAa;CAAE,KAAK;CAAK,MAAM;CAAsB,UAAU;AAAY,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"refs.mjs","names":["Arr","Str","SEPARATOR","Rec","Arr","Str","Arr","Arr"],"sources":["../src/features/check-references/model/markdown-texts.ts","../src/features/check-references/model/declared-symbols.ts","../src/features/check-references/model/resolve-reference.ts","../src/features/check-references/model/unresolved-references.ts","../bin/msch-refs.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst MARKDOWN = \".md\";\nconst FIXTURE = /(?:^|\\/)fixtures\\//u;\nconst READ_CONCURRENCY = 16;\n\n/** @internal */\nexport interface MarkdownText {\n readonly file: string;\n readonly source: string;\n}\n\n/** @internal */\nexport const markdownTexts = Effect.fn(\"markdownTexts\")(function* markdownTexts(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const documents = pipe(\n listed,\n Arr.filter((file) => Str.endsWith(MARKDOWN)(file) && !FIXTURE.test(file)),\n Arr.map((file) => files.join(root, file)),\n );\n const read = yield* Effect.forEach(\n documents,\n (file) =>\n Effect.map(\n files.readFile(file),\n Option.map((source): MarkdownText => ({ file, source })),\n ),\n { concurrency: READ_CONCURRENCY },\n );\n return Arr.getSomes(read);\n});\n","import { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { Array as Arr, Effect, HashSet, Option, Record as Rec, pipe } from \"effect\";\n\nimport { loadLanguage, readTree } from \"#/shared/lib/tree-sitter.ts\";\nimport type { SyntaxNode } from \"#/shared/lib/tree-sitter.ts\";\n\nconst GRAMMAR_OF: Readonly<Record<string, string>> = {\n ts: \"typescript\",\n mts: \"typescript\",\n cts: \"typescript\",\n tsx: \"tsx\",\n js: \"javascript\",\n mjs: \"javascript\",\n cjs: \"javascript\",\n jsx: \"javascript\",\n rs: \"rust\",\n py: \"python\",\n go: \"go\",\n java: \"java\",\n rb: \"ruby\",\n php: \"php\",\n cs: \"c-sharp\",\n cpp: \"cpp\",\n};\nconst IMPLEMENTATION = \"impl_item\";\nconst NAME_FIELD = \"name\";\nconst TYPE_FIELD = \"type\";\nconst SEPARATOR = \".\";\nconst EXTENSION = /\\.(?<extension>[^./]+)$/u;\nconst FIRST = 0;\nconst ONE = 1;\n\nexport const supportedExtensions: readonly string[] = Rec.keys(GRAMMAR_OF);\n\nexport const grammarOf = (path: string): Option.Option<string> =>\n pipe(\n groupOf(\"extension\")(EXTENSION.exec(path)),\n Option.flatMap((extension) => Rec.get(GRAMMAR_OF, extension)),\n );\n\nconst implementedType = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.liftPredicate(node, ({ type }) => type === IMPLEMENTATION),\n Option.flatMap((implementation) =>\n Option.fromNullishOr(implementation.childForFieldName(TYPE_FIELD)),\n ),\n );\n\nconst nameNodeOf = (node: SyntaxNode): Option.Option<SyntaxNode> =>\n pipe(\n Option.fromNullishOr(node.childForFieldName(NAME_FIELD)),\n Option.orElse(() => implementedType(node)),\n );\n\nconst suffixesOf = (chain: readonly string[]): readonly string[] =>\n pipe(\n Arr.range(FIRST, chain.length - ONE),\n Arr.map((from) => Arr.join(Arr.drop(chain, from), SEPARATOR)),\n );\n\nconst childrenOf = (node: SyntaxNode): readonly SyntaxNode[] =>\n pipe(\n node.namedChildren,\n Arr.flatMap((child) => Option.toArray(Option.fromNullishOr(child))),\n );\n\nconst namesUnder = (node: SyntaxNode, enclosing: readonly string[]): readonly string[] => {\n const own = Option.map(nameNodeOf(node), ({ text }) => text);\n const chain = Option.match(own, {\n onNone: () => enclosing,\n onSome: (name) => [...enclosing, name],\n });\n const declared = Option.match(own, { onNone: () => [], onSome: () => suffixesOf(chain) });\n return [...declared, ...Arr.flatMap(childrenOf(node), (child) => namesUnder(child, chain))];\n};\n\nexport const declaredSymbols = Effect.fn(\"declaredSymbols\")(function* declaredSymbols(\n grammar: string,\n source: string,\n) {\n const language = yield* loadLanguage(grammar);\n return pipe(\n readTree({ language, source, read: (root) => HashSet.fromIterable(namesUnder(root, [])) }),\n Option.getOrElse(() => HashSet.empty<string>()),\n );\n});\n","import { NO_PATH } from \"@r_masseater/y8\";\nimport type { GithubReference, NpmReference, Reference } from \"@r_masseater/y8\";\nimport { Array as Arr, Effect, HashSet, Match, Option, Schema, String as Str, pipe } from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient, HttpClientError } from \"effect/http\";\n\nimport { githubToken, jsonLookup, sent } from \"#/shared/lib/lookup.ts\";\nimport type { Lookup } from \"#/shared/lib/lookup.ts\";\nimport { abbreviatedLookup } from \"#/shared/lib/package-routes.ts\";\n\nimport { declaredSymbols, grammarOf, supportedExtensions } from \"./declared-symbols.ts\";\n\nconst GITHUB = \"https://api.github.com/repos/\";\nconst RAW = \"application/vnd.github.raw+json\";\nconst NOT_FOUND = 404;\nconst MULTIPLE_CHOICES = 300;\nconst SEPARATOR = \"/\";\nconst LATEST = \"latest\";\n\n/** @internal */\nexport type Outcome =\n | { readonly kind: \"found\" }\n | { readonly kind: \"broken\"; readonly reason: string }\n | { readonly kind: \"unchecked\"; readonly reason: string };\n\nconst found: Outcome = { kind: \"found\" };\nconst broken = (reason: string): Outcome => ({ kind: \"broken\", reason });\nconst unchecked = (reason: string): Outcome => ({ kind: \"unchecked\", reason });\n\nconst Repository = Schema.Struct({\n full_name: Schema.String,\n archived: Schema.Boolean,\n default_branch: Schema.String,\n});\nconst Version = Schema.Struct({ deprecated: Schema.optional(Schema.String) });\nconst Packument = Schema.Struct({\n \"dist-tags\": Schema.Record(Schema.String, Schema.String),\n versions: Schema.Record(Schema.String, Version),\n});\n\ntype Failure = HttpClientError.HttpClientError | Schema.SchemaError;\ntype Lookups = Effect.Effect<Outcome, Failure, HttpClient.HttpClient>;\n\nconst answered = (\n lookup: Lookup,\n missing: string,\n next: (response: HttpClientResponse.HttpClientResponse) => Lookups,\n): Lookups =>\n Effect.flatMap(sent(lookup), (response) => {\n if (response.status === NOT_FOUND) {\n return Effect.succeed(broken(missing));\n }\n if (response.status >= MULTIPLE_CHOICES) {\n return Effect.succeed(unchecked(`the lookup answered HTTP ${String(response.status)}`));\n }\n return next(response);\n });\n\nconst encodedPath = (path: string): string =>\n pipe(Str.split(path, SEPARATOR), Arr.map(encodeURIComponent), Arr.join(SEPARATOR));\n\nconst repositoryOutcome = (\n { owner, repo }: GithubReference,\n repository: typeof Repository.Type,\n): Outcome => {\n if (Str.toLowerCase(repository.full_name) !== Str.toLowerCase(`${owner}/${repo}`)) {\n return broken(`${owner}/${repo} has moved to ${repository.full_name}. Point at the new name.`);\n }\n if (repository.archived) {\n return broken(\n `${owner}/${repo} is archived. Point at the repository that replaced it, or drop the pointer.`,\n );\n }\n return found;\n};\n\nconst symbolOutcome = Effect.fn(\"symbolOutcome\")(function* symbolOutcome(\n { path }: GithubReference,\n symbol: string,\n source: string,\n) {\n const grammar = grammarOf(path);\n if (Option.isNone(grammar)) {\n return broken(\n `${path} is not a file msch can read symbols from. Drop #${symbol}, or point at a file with one of the extensions ${Arr.join(supportedExtensions, \", \")}.`,\n );\n }\n const declared = yield* Effect.option(declaredSymbols(grammar.value, source));\n return Option.match(declared, {\n onNone: () => unchecked(`the ${grammar.value} grammar could not read ${path}`),\n onSome: (names) => {\n if (HashSet.has(names, symbol)) {\n return found;\n }\n return broken(`${path} declares no ${symbol}. Fix the name or point at where it lives now.`);\n },\n });\n});\n\nconst repositoryContentsOutcome = (\n reference: GithubReference,\n repository: typeof Repository.Type,\n token: Option.Option<string>,\n): Lookups => {\n const checked = repositoryOutcome(reference, repository);\n if (checked.kind !== \"found\" || reference.path === NO_PATH) {\n return Effect.succeed(checked);\n }\n const branch = Option.getOrElse(reference.ref, () => repository.default_branch);\n const url = `${GITHUB}${reference.owner}/${reference.repo}/contents/${encodedPath(reference.path)}?ref=${encodeURIComponent(branch)}`;\n const missing = `${reference.path} does not exist on ${branch} of ${reference.owner}/${reference.repo}. Point at where it lives now.`;\n return Option.match(reference.symbol, {\n onNone: () => answered(jsonLookup({ url, token }), missing, () => Effect.succeed(found)),\n onSome: (symbol) =>\n answered({ url, token, accept: RAW }, missing, (response) =>\n response.text.pipe(Effect.flatMap((source) => symbolOutcome(reference, symbol, source))),\n ),\n });\n};\n\nconst githubOutcome = Effect.fn(\"githubOutcome\")(function* githubOutcome(\n reference: GithubReference,\n) {\n const token = yield* githubToken;\n const lookup = jsonLookup({ url: `${GITHUB}${reference.owner}/${reference.repo}`, token });\n const missing = `${reference.owner}/${reference.repo} does not exist, or the token in GH_TOKEN cannot read it.`;\n return yield* answered(lookup, missing, (response) =>\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Repository)(response), (repository) =>\n repositoryContentsOutcome(reference, repository, token),\n ),\n );\n});\n\nconst versionOf = (\n { \"dist-tags\": tags }: typeof Packument.Type,\n requested: Option.Option<string>,\n): Option.Option<string> =>\n Option.match(requested, {\n onNone: () => Option.fromNullishOr(tags[LATEST]),\n onSome: (asked) =>\n Option.some(Option.getOrElse(Option.fromNullishOr(tags[asked]), () => asked)),\n });\n\nconst versionOutcome = (\n { name, version }: NpmReference,\n packument: typeof Packument.Type,\n): Outcome =>\n Option.match(versionOf(packument, version), {\n onNone: () => broken(`${name} has no ${LATEST} tag.`),\n onSome: (resolved) =>\n Option.match(Option.fromNullishOr(packument.versions[resolved]), {\n onNone: () => broken(`${name}@${resolved} is not published on npm.`),\n onSome: ({ deprecated }) =>\n Option.match(Option.fromNullishOr(deprecated), {\n onNone: () => found,\n onSome: (message) => broken(`${name}@${resolved} is deprecated: ${message}`),\n }),\n }),\n });\n\nconst npmOutcome = (reference: NpmReference): Lookups =>\n answered(\n abbreviatedLookup(reference.name),\n `${reference.name} is not published on npm.`,\n (response) =>\n Effect.map(HttpClientResponse.schemaBodyJson(Packument)(response), (packument) =>\n versionOutcome(reference, packument),\n ),\n );\n\n/** @internal */\nexport const resolveReference = (\n reference: Reference,\n): Effect.Effect<Outcome, never, HttpClient.HttpClient> =>\n Match.value(reference).pipe(\n Match.discriminatorsExhaustive(\"kind\")({ github: githubOutcome, npm: npmOutcome }),\n Effect.match({\n onFailure: (failure) => unchecked(`the lookup failed: ${String(failure)}`),\n onSuccess: (outcome) => outcome,\n }),\n );\n","import { describeReference, linksIn, referenceOf } from \"@r_masseater/y8\";\nimport type { LinkAt, Reference } from \"@r_masseater/y8\";\nimport { Array as Arr, Effect, HashMap, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { markdownTexts } from \"./markdown-texts.ts\";\nimport { resolveReference } from \"./resolve-reference.ts\";\nimport type { Outcome } from \"./resolve-reference.ts\";\n\nconst LOOKUP_CONCURRENCY = 4;\n\n/** @internal */\nexport interface UnresolvedReference {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n readonly outcome: \"broken\" | \"unchecked\";\n readonly reason: string;\n}\n\ninterface Occurrence {\n readonly file: string;\n readonly line: number;\n readonly reference: Reference;\n}\n\nconst occurrencesIn = (links: readonly LinkAt[]): readonly Occurrence[] =>\n pipe(\n links,\n Arr.flatMap(({ path, line, destination }) =>\n pipe(\n referenceOf(destination),\n Option.map((reference): Occurrence => ({ file: path, line, reference })),\n Option.toArray,\n ),\n ),\n );\n\ninterface Place {\n readonly file: string;\n readonly line: number;\n readonly reference: string;\n}\n\nconst unresolvedAt =\n (place: Place) =>\n (outcome: Outcome): Option.Option<UnresolvedReference> => {\n if (outcome.kind === \"found\") {\n return Option.none();\n }\n return Option.some({ ...place, outcome: outcome.kind, reason: outcome.reason });\n };\n\nconst unresolvedOf =\n (outcomes: HashMap.HashMap<string, Outcome>) =>\n ({ file, line, reference }: Occurrence): readonly UnresolvedReference[] => {\n const described = describeReference(reference);\n return pipe(\n outcomes,\n HashMap.get(described),\n Option.flatMap(unresolvedAt({ file, line, reference: described })),\n Option.toArray,\n );\n };\n\n/** @internal */\nexport const unresolvedReferences = Effect.fn(\"unresolvedReferences\")(\n function* unresolvedReferences(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* markdownTexts(root);\n const links = yield* linksIn(\n pipe(\n texts,\n Arr.map(({ file, source }) => ({ path: files.relative(root, file), text: source })),\n ),\n );\n const occurrences = occurrencesIn(links);\n const distinct = pipe(\n occurrences,\n Arr.dedupeWith(\n (left, right) => describeReference(left.reference) === describeReference(right.reference),\n ),\n Arr.map(({ reference }) => reference),\n );\n const resolved = yield* Effect.forEach(\n distinct,\n (reference) =>\n Effect.map(\n resolveReference(reference),\n (outcome) => [describeReference(reference), outcome] as const,\n ),\n { concurrency: LOOKUP_CONCURRENCY },\n );\n const outcomes = HashMap.fromIterable(resolved);\n return pipe(occurrences, Arr.flatMap(unresolvedOf(outcomes)));\n },\n);\n","#!/usr/bin/env node\nimport { Schema } from \"effect\";\n\nimport { lookupReport } from \"#/app/lookup-report.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { unresolvedReferences } from \"#/features/check-references/index.ts\";\n\nconst Row = Schema.Struct({\n file: Schema.String,\n line: Schema.Finite,\n reference: Schema.String,\n outcome: Schema.Literals([\"broken\", \"unchecked\"]),\n reason: Schema.String,\n});\n\ntype RowType = typeof Row.Type;\n\nconst VERDICTS: Readonly<Record<RowType[\"outcome\"], string>> = {\n broken: \"is stale:\",\n unchecked: \"could not be checked:\",\n};\n\nconst describeRow = (row: RowType): string =>\n `${row.file}:${String(row.line)} ${row.reference} ${VERDICTS[row.outcome]} ${row.reason}`;\n\nrunCli(\"msch-refs\")(lookupReport({ row: Row, rows: unresolvedReferences, describe: describeRow }));\n"],"mappings":";;;;;;;;;;AAIA,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,mBAAmB;;AASzB,MAAa,gBAAgB,OAAO,GAAG,eAAe,CAAC,CAAC,UAAU,cAAc,MAAc;CAC5F,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,OAAO,MAAM,YAAY,IAAI;CAC5C,MAAM,YAAY,KAChB,QACAA,MAAI,QAAQ,SAASC,SAAI,SAAS,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,GACxED,MAAI,KAAK,SAAS,MAAM,KAAK,MAAM,IAAI,CAAC,CAC1C;CACA,MAAM,OAAO,OAAO,OAAO,QACzB,YACC,SACC,OAAO,IACL,MAAM,SAAS,IAAI,GACnB,OAAO,KAAK,YAA0B;EAAE;EAAM;CAAO,EAAE,CACzD,GACF,EAAE,aAAa,iBAAiB,CAClC;CACA,OAAOA,MAAI,S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packageLookup, l as publicLookup, o as fetched, u as sent } from "./package-routes-
|
|
1
|
+
import { i as packageLookup, l as publicLookup, o as fetched, u as sent } from "./package-routes-BQWX5ttU.mjs";
|
|
2
2
|
import { Array, Effect, Option, Record, Schema, pipe } from "effect";
|
|
3
3
|
import { HttpClientResponse } from "effect/http";
|
|
4
4
|
// src/shared/lib/registry-releases.ts
|
|
@@ -59,4 +59,4 @@ const registryRelease = Effect.fn("registryRelease")(function* registryRelease(r
|
|
|
59
59
|
});
|
|
60
60
|
export { registryRelease as t };
|
|
61
61
|
|
|
62
|
-
//# sourceMappingURL=registry-releases-
|
|
62
|
+
//# sourceMappingURL=registry-releases-BBtz4wGE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-releases-
|
|
1
|
+
{"version":3,"file":"registry-releases-BBtz4wGE.mjs","names":["Arr","Rec"],"sources":["../src/shared/lib/registry-releases.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { HttpClientResponse } from \"effect/http\";\nimport type { HttpClient, HttpClientError } from \"effect/http\";\n\nimport { fetched, publicLookup, sent } from \"./lookup.ts\";\nimport { packageLookup } from \"./package-routes.ts\";\n\nconst CRATES = \"https://crates.io/api/v1/crates/\";\n\nconst DECLARING_SECTIONS = [\"optionalDependencies\", \"peerDependencies\", \"dependencies\"] as const;\nconst Dependencies = Schema.Record(Schema.String, Schema.String);\nconst NpmVersion = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeDependencies = Schema.decodeUnknownOption(Dependencies);\nconst NOT_FOUND = 404;\nconst NOT_PUBLISHED: Release = { versions: [], latestDependencies: {} };\nconst NpmPackument = Schema.Struct({\n \"dist-tags\": Schema.Struct({ latest: Schema.String }),\n versions: Schema.Record(Schema.String, NpmVersion),\n});\nconst Crate = Schema.Struct({\n crate: Schema.Struct({\n max_stable_version: Schema.NullOr(Schema.String),\n newest_version: Schema.String,\n }),\n versions: Schema.Array(Schema.Struct({ num: Schema.String, yanked: Schema.Boolean })),\n});\nconst CrateDependencies = Schema.Struct({\n dependencies: Schema.Array(Schema.Struct({ crate_id: Schema.String, req: Schema.String })),\n});\n\ntype NpmVersionType = typeof NpmVersion.Type;\n\n/** @internal */\nexport type LookupError = HttpClientError.HttpClientError | Schema.SchemaError;\n\n/** @internal */\nexport type Registry = \"npm\" | \"crate\";\n\n/** @internal */\nexport interface Release {\n readonly versions: readonly string[];\n readonly latestDependencies: Readonly<Record<string, string>>;\n}\n\nconst declaredBy = (version: NpmVersionType): Readonly<Record<string, string>> =>\n pipe(\n DECLARING_SECTIONS,\n Arr.flatMap((section) =>\n pipe(\n decodeDependencies(version[section]),\n Option.map(Rec.toEntries),\n Option.getOrElse((): readonly (readonly [string, string])[] => []),\n ),\n ),\n Rec.fromEntries,\n );\n\nconst releaseOfPackument = ({\n \"dist-tags\": tags,\n versions,\n}: typeof NpmPackument.Type): Release => ({\n versions: Rec.keys(versions),\n latestDependencies: pipe(\n Rec.get(versions, tags.latest),\n Option.map(declaredBy),\n Option.getOrElse(() => ({})),\n ),\n});\n\nconst npmRelease = (name: string): Effect.Effect<Release, LookupError, HttpClient.HttpClient> =>\n sent(packageLookup(name)).pipe(\n Effect.flatMap((response) => {\n if (response.status === NOT_FOUND) {\n return Effect.succeed(NOT_PUBLISHED);\n }\n return HttpClientResponse.filterStatusOk(response).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(NpmPackument)),\n Effect.map(releaseOfPackument),\n );\n }),\n );\n\nconst crateRelease = Effect.fn(\"crateRelease\")(function* lookupCrate(name: string) {\n const found = yield* fetched(publicLookup(`${CRATES}${name}`)).pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Crate)),\n );\n const latest = found.crate.max_stable_version ?? found.crate.newest_version;\n const { dependencies } = yield* fetched(\n publicLookup(`${CRATES}${name}/${latest}/dependencies`),\n ).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(CrateDependencies)));\n const release: Release = {\n versions: pipe(\n found.versions,\n Arr.filter(({ yanked }) => !yanked),\n Arr.map(({ num }) => num),\n ),\n latestDependencies: Rec.fromEntries(\n pipe(\n dependencies,\n Arr.map(({ crate_id: crateId, req }) => [crateId, req] as const),\n ),\n ),\n };\n return release;\n});\n\n/** @internal */\nexport const registryRelease = Effect.fn(\"registryRelease\")(function* registryRelease(\n registry: Registry,\n name: string,\n) {\n if (registry === \"npm\") {\n return yield* npmRelease(name);\n }\n return yield* crateRelease(name);\n});\n"],"mappings":";;;;AAOA,MAAM,SAAS;AAEf,MAAM,qBAAqB;CAAC;CAAwB;CAAoB;AAAc;AACtF,MAAM,eAAe,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM;AAC/D,MAAM,aAAa,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAC9D,MAAM,qBAAqB,OAAO,oBAAoB,YAAY;AAClE,MAAM,YAAY;AAClB,MAAM,gBAAyB;CAAE,UAAU,CAAC;CAAG,oBAAoB,CAAC;AAAE;AACtE,MAAM,eAAe,OAAO,OAAO;CACjC,aAAa,OAAO,OAAO,EAAE,QAAQ,OAAO,OAAO,CAAC;CACpD,UAAU,OAAO,OAAO,OAAO,QAAQ,UAAU;AACnD,CAAC;AACD,MAAM,QAAQ,OAAO,OAAO;CAC1B,OAAO,OAAO,OAAO;EACnB,oBAAoB,OAAO,OAAO,OAAO,MAAM;EAC/C,gBAAgB,OAAO;CACzB,CAAC;CACD,UAAU,OAAO,MAAM,OAAO,OAAO;EAAE,KAAK,OAAO;EAAQ,QAAQ,OAAO;CAAQ,CAAC,CAAC;AACtF,CAAC;AACD,MAAM,oBAAoB,OAAO,OAAO,EACtC,cAAc,OAAO,MAAM,OAAO,OAAO;CAAE,UAAU,OAAO;CAAQ,KAAK,OAAO;AAAO,CAAC,CAAC,EAC3F,CAAC;AAgBD,MAAM,cAAc,YAClB,KACE,oBACAA,MAAI,SAAS,YACX,KACE,mBAAmB,QAAQ,QAAQ,GACnC,OAAO,IAAIC,O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G,iBAAiB,CAAC,CAAC,UAAU,gBACpE,UACA,MACA;CACA,IAAI,aAAa,OACf,OAAO,OAAO,WAAW,IAAI;CAE/B,OAAO,OAAO,aAAa,IAAI;AACjC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Array, Context, Effect, FileSystem, Layer, Option, Path, Stream, String, pipe } from "effect";
|
|
1
|
+
import { Array, Context, Effect, FileSystem, Layer, Option, Order, Path, Stream, String, pipe } from "effect";
|
|
3
2
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
3
|
import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
|
|
5
4
|
import { CACHE_DIRECTORY_NAME } from "@r_masseater/masseater-utils/plugin-kit";
|
|
6
5
|
import { Digest } from "effect/crypto";
|
|
6
|
+
Order.mapInput(String.Order, ([key]) => key);
|
|
7
|
+
const groupOf = (name) => (found) => pipe(Option.fromNullishOr(found), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups[name])));
|
|
7
8
|
// src/shared/lib/tool-name.ts
|
|
8
9
|
const TOOL_NAME = "msch";
|
|
9
10
|
// src/shared/lib/repository-files.ts
|
|
@@ -156,6 +157,6 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
|
|
|
156
157
|
basename: (file) => path.basename(file)
|
|
157
158
|
});
|
|
158
159
|
})).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
|
|
159
|
-
export { nodeServicesLayer as a, nodeRepositoryFiles as i, NODE_MODULES as n, TOOL_NAME as o, RepositoryFiles as r, MSCH_CACHE as t };
|
|
160
|
+
export { nodeServicesLayer as a, nodeRepositoryFiles as i, NODE_MODULES as n, TOOL_NAME as o, RepositoryFiles as r, groupOf as s, MSCH_CACHE as t };
|
|
160
161
|
|
|
161
|
-
//# sourceMappingURL=repository-files-
|
|
162
|
+
//# sourceMappingURL=repository-files-DSwKJnrj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-files-DSwKJnrj.mjs","names":["Str","Str","Arr"],"sources":["../../lint-host/src/shared/lib/collections.ts","../src/shared/lib/tool-name.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import { Array as Arr, Option, Order, Record as Rec, String as Str, pipe } from \"effect\";\n\nconst byKey = Order.mapInput(Str.Order, ([key]: readonly [string, unknown]) => key);\n\nexport const sortedRecord = <Value>(\n entries: readonly (readonly [string, Value])[],\n): Readonly<Record<string, Value>> => Rec.fromEntries(Arr.sort(entries, byKey));\n\nconst NEXT = 1;\n\nexport interface Grouped<Head, Item> {\n readonly head: Head;\n readonly items: readonly Item[];\n}\n\nexport const groupedUnder =\n <Item, Head>(asHead: (item: Item) => Option.Option<Head>) =>\n (closes: (head: Head, item: Item) => boolean) =>\n (items: readonly Item[]): readonly Grouped<Head, Item>[] =>\n pipe(\n items,\n Arr.flatMap((item, index) =>\n pipe(\n asHead(item),\n Option.map((head): Grouped<Head, Item> => ({\n head,\n items: pipe(\n items,\n Arr.drop(index + NEXT),\n Arr.takeWhile((next) => !closes(head, next)),\n ),\n })),\n Option.toArray,\n ),\n ),\n );\n\nexport const ancestorsBy =\n <Node>(parentOf: (node: Node) => Option.Option<Node>) =>\n (node: Node): readonly Node[] =>\n Arr.unfold(parentOf(node), (current) =>\n pipe(\n current,\n Option.map((found) => [found, parentOf(found)] as const),\n ),\n );\n\nexport const groupOf =\n (name: string) =>\n (found: RegExpMatchArray | null): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(found),\n Option.flatMap((match) => Option.fromNullishOr(match.groups)),\n Option.flatMap((groups) => Option.fromNullishOr(groups[name])),\n );\n","export const TOOL_NAME = \"msch\";\n","import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { groupOf } from \"@masseater.dev/lint-host/collections\";\nimport { CACHE_DIRECTORY_NAME } from \"@r_masseater/masseater-utils/plugin-kit\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Digest } from \"effect/crypto\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { TOOL_NAME } from \"#/shared/lib/tool-name.ts\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\nconst MISSING_SIZE = 0;\nconst MILLISECONDS = 1000;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst OWNED_PATHSPECS = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\nexport const NODE_MODULES = \"node_modules\";\n\n/** @internal */\nexport const MSCH_CACHE = [NODE_MODULES, CACHE_DIRECTORY_NAME, TOOL_NAME] as const;\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\", `--exclude=${NODE_MODULES}/`];\nconst IGNORED_ARGS = [\"--others\", \"--ignored\", \"--exclude-standard\"];\nconst TRACKED_ARGS = [\"--cached\"];\nconst STAGED_ARGS = [\"--stage\"];\nconst LINK_ENTRY = /^120000 \\S+ \\d+\\t(?<name>.+)$/u;\n\nexport class RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly walkDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly writeFile: (file: string, text: string) => Effect.Effect<void>;\n readonly removeFile: (file: string) => Effect.Effect<void>;\n readonly hash: (text: string) => Effect.Effect<string>;\n readonly hashFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly ownedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly linkedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly readLink: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly mergeBase: (root: string, revision: string) => Effect.Effect<Option.Option<string>>;\n readonly originUrl: (root: string) => Effect.Effect<Option.Option<string>>;\n readonly changedFiles: (root: string, revision: string) => Effect.Effect<readonly string[]>;\n readonly readAtRevision: (\n root: string,\n revision: string,\n name: string,\n ) => Effect.Effect<Option.Option<string>>;\n readonly committedAt: (root: string, name: string) => Effect.Effect<Option.Option<number>>;\n readonly matchingFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly trackedFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredPaths: (\n root: string,\n paths: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/shared/lib/repository-files/RepositoryFiles\") {}\n\nconst SUCCESS = 0;\n\ntype GitText = (root: string, args: readonly string[]) => Effect.Effect<Option.Option<string>>;\n\nconst gitTextService = Effect.gen(function* gitTextService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitText: GitText = (root, args) =>\n Effect.gen(function* readText() {\n const handle = yield* ChildProcess.make(\"git\", args, { cwd: root, stdin: \"ignore\" });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return Option.liftPredicate(text, () => code === SUCCESS);\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return gitText;\n});\n\ntype GitPaths = (\n root: string,\n args: readonly string[],\n separator: string,\n) => Effect.Effect<readonly string[]>;\n\nconst gitPathsService = Effect.gen(function* gitPathsService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitPaths: GitPaths = (root, args, separator) =>\n Effect.gen(function* listPaths() {\n const handle = yield* ChildProcess.make(\"git\", args, {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, separator), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return gitPaths;\n});\n\nconst linkName = (entry: string): readonly string[] =>\n Option.toArray(groupOf(\"name\")(LINK_ENTRY.exec(entry)));\n\ntype CacheOperations = Pick<\n typeof RepositoryFiles.Service,\n \"walkDirectory\" | \"writeFile\" | \"removeFile\" | \"hash\" | \"hashFile\"\n>;\n\nconst encoder = new TextEncoder();\n\nconst cacheOperations = (\n fs: FileSystem.FileSystem,\n path: Path.Path,\n digest: Digest.Digest[\"Service\"],\n): CacheOperations => ({\n walkDirectory: (directory) =>\n fs\n .readDirectory(directory, { recursive: true })\n .pipe(Effect.orElseSucceed((): readonly string[] => [])),\n writeFile: (file, text) =>\n fs\n .makeDirectory(path.dirname(file), { recursive: true })\n .pipe(Effect.andThen(fs.writeFileString(file, text)), Effect.ignore),\n removeFile: (file) => fs.remove(file, { force: true }).pipe(Effect.ignore),\n hash: (text) => digest.digestHex(Digest.sha256, encoder.encode(text)),\n hashFile: (file) =>\n fs.readFile(file).pipe(\n Effect.flatMap((bytes) => digest.digestHex(Digest.sha256, bytes)),\n Effect.option,\n ),\n});\n\nconst gitFiles =\n (gitPaths: GitPaths) =>\n (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n gitPaths(root, [\"ls-files\", \"-z\", ...args], \"\\0\");\n\nconst gitOperations = (\n gitPaths: GitPaths,\n gitText: GitText,\n): Pick<\n RepositoryFiles[\"Service\"],\n | \"changedFiles\"\n | \"committedAt\"\n | \"ignoredFiles\"\n | \"ignoredPaths\"\n | \"linkedFiles\"\n | \"listedFiles\"\n | \"matchingFiles\"\n | \"mergeBase\"\n | \"originUrl\"\n | \"ownedFiles\"\n | \"readAtRevision\"\n | \"trackedFiles\"\n> => {\n const files = gitFiles(gitPaths);\n return {\n listedFiles: (root) => files(root, LISTED_ARGS),\n ownedFiles: (root) => files(root, [...LISTED_ARGS, \"--\", ...OWNED_PATHSPECS]),\n linkedFiles: (root) => files(root, STAGED_ARGS).pipe(Effect.map(Arr.flatMap(linkName))),\n mergeBase: (root, revision) =>\n gitText(root, [\"merge-base\", \"HEAD\", revision]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n originUrl: (root) =>\n gitText(root, [\"config\", \"--get\", \"remote.origin.url\"]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n changedFiles: (root, revision) =>\n gitPaths(root, [\"diff\", \"--name-only\", \"--no-renames\", \"-z\", revision], \"\\0\"),\n readAtRevision: (root, revision, name) => gitText(root, [\"show\", `${revision}:${name}`]),\n committedAt: (root, name) =>\n gitText(root, [\"log\", \"-1\", \"--format=%ct\", \"HEAD\", \"--\", name]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n Effect.map(Option.map((seconds) => Number(seconds) * MILLISECONDS)),\n ),\n matchingFiles: (root, pathspecs) => files(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n trackedFiles: (root, pathspecs) => files(root, [...TRACKED_ARGS, \"--\", ...pathspecs]),\n ignoredFiles: (root, pathspecs) => files(root, [...IGNORED_ARGS, \"--\", ...pathspecs]),\n ignoredPaths: (root, paths) => gitPaths(root, [\"check-ignore\", \"--\", ...paths], \"\\n\"),\n };\n};\n\nexport const nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const digest = yield* Digest.Digest;\n const gitPaths = yield* gitPathsService;\n const gitText = yield* gitTextService;\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(gitPaths)(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n ...gitOperations(gitPaths, gitText),\n readLink: (file) => fs.readLink(file).pipe(Effect.option),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n ...cacheOperations(fs, path, digest),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));\n"],"mappings":";;;;;AAEc,MAAM,SAASA,OAAI,QAAQ,CAAC,SAAqC,GAAG;AA6ClF,MAAa,WACV,UACA,UACC,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,SAAS,UAAU,OAAO,cAAc,MAAM,MA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,OAAO,KAAK,SAAS,OAAO,KAAK,IAAI,CAAC,GACtC,OAAO,oBAAoB,YAAY,CACzC;EACF,OAAO,GAAG,aAAa,KAAK,KAAK,GAAG,QAAQ;EAC5C,UAAU,GAAG,aAAa,KAAK,QAAQ,GAAG,QAAQ;EAClD,WAAW,MAAM,OAAO,KAAK,SAAS,MAAM,EAAE;EAC9C,UAAU,SAAS,KAAK,QAAQ,IAAI;EACpC,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,CAAC;AACH,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { S as exempt, a as textlintPresets, i as textlintFilters } from "./define-lint-preset-B-hC9_df.mjs";
|
|
2
|
+
import { Array, Record, pipe } from "effect";
|
|
3
|
+
import { betterleaks } from "@r_masseater/h56m/presets";
|
|
4
|
+
// src/app/repository-tasks.ts
|
|
5
|
+
const NOT_INPUTS = [
|
|
6
|
+
"!node_modules/.pnpm-store",
|
|
7
|
+
"!node_modules/.pnpm-store/**",
|
|
8
|
+
"!node_modules/.tmp",
|
|
9
|
+
"!node_modules/.tmp/**",
|
|
10
|
+
"!target/**",
|
|
11
|
+
"!node_modules/.vitest-cache/**",
|
|
12
|
+
"!node_modules/.cache/**"
|
|
13
|
+
];
|
|
14
|
+
const UNTRACKED_ENV = [
|
|
15
|
+
"CLOUDFLARE_ACCOUNT_ID",
|
|
16
|
+
"CLOUDFLARE_AI_GATEWAY_ID",
|
|
17
|
+
"CLOUDFLARE_API_TOKEN",
|
|
18
|
+
"CLAUDECODE",
|
|
19
|
+
"CLAUDE_CODE_REMOTE",
|
|
20
|
+
"GITHUB_ACTIONS",
|
|
21
|
+
"HTTPS_PROXY",
|
|
22
|
+
"https_proxy",
|
|
23
|
+
"NO_PROXY",
|
|
24
|
+
"no_proxy",
|
|
25
|
+
"SSL_CERT_FILE",
|
|
26
|
+
"NODE_EXTRA_CA_CERTS"
|
|
27
|
+
];
|
|
28
|
+
const FALLOW = pipe([
|
|
29
|
+
"--skip dupes --fail-on-issues --quiet --format compact",
|
|
30
|
+
"dead-code --no-production --fail-on-issues --quiet --format compact",
|
|
31
|
+
"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'",
|
|
32
|
+
"dupes --fail-on-issues --quiet --format compact",
|
|
33
|
+
"security --fail-on-issues --quiet"
|
|
34
|
+
], Array.map((args) => `FALLOW_TYPE_AWARE_BACKEND=tsrs fallow ${args}`));
|
|
35
|
+
const CHECK = `TSRS_LINT_RUN_EXTERNAL_CODE=1 msch-changed --batch-sources ${String(1e3)} vp check --deny-warnings --continue-on-error`;
|
|
36
|
+
const COMPAT = "msch-changed msch-publish compat-changed";
|
|
37
|
+
const AUDIT = "before=\"$(cksum pnpm-workspace.yaml)\"; vp pm audit --fix || exit; if [ \"$before\" != \"$(cksum pnpm-workspace.yaml)\" ]; then echo \"vp pm audit --fix rewrote pnpm-workspace.yaml. Run vp install and commit the diff.\" >&2; exit 1; fi";
|
|
38
|
+
const BROKER_TOKEN = `GH_TOKEN="\${GITHUB_APP_TOKEN:-$GH_TOKEN}"`;
|
|
39
|
+
const DAILY = `msch-exits; ${BROKER_TOKEN} msch-upstream; ${BROKER_TOKEN} msch-refs`;
|
|
40
|
+
const TEST = "msch-changed vp test run --passWithNoTests";
|
|
41
|
+
const MSCH_TASK_COMMANDS = {
|
|
42
|
+
fallow: FALLOW,
|
|
43
|
+
check: CHECK,
|
|
44
|
+
test: TEST,
|
|
45
|
+
msch: "msch",
|
|
46
|
+
audit: AUDIT,
|
|
47
|
+
published: "msch-published",
|
|
48
|
+
compat: COMPAT
|
|
49
|
+
};
|
|
50
|
+
const tasksOf = ({ workspace, commands }) => {
|
|
51
|
+
const inputs = [
|
|
52
|
+
{ auto: true },
|
|
53
|
+
...workspace.ignoredDirectories,
|
|
54
|
+
...NOT_INPUTS
|
|
55
|
+
];
|
|
56
|
+
const checks = {
|
|
57
|
+
...commands,
|
|
58
|
+
fallow: {
|
|
59
|
+
command: FALLOW,
|
|
60
|
+
cache: {
|
|
61
|
+
input: [
|
|
62
|
+
...inputs,
|
|
63
|
+
"!.fallow/**",
|
|
64
|
+
"!**/dist/**",
|
|
65
|
+
"!**/.fallow-verified"
|
|
66
|
+
],
|
|
67
|
+
output: []
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
check: {
|
|
71
|
+
command: CHECK,
|
|
72
|
+
cache: {
|
|
73
|
+
input: inputs,
|
|
74
|
+
untrackedEnv: UNTRACKED_ENV
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
test: {
|
|
78
|
+
command: TEST,
|
|
79
|
+
dependsOn: ["check", ...workspace.tasks.native],
|
|
80
|
+
cache: { input: [...inputs, "!**/.cache/**"] }
|
|
81
|
+
},
|
|
82
|
+
msch: {
|
|
83
|
+
command: "msch",
|
|
84
|
+
dependsOn: ["check", ...workspace.tasks.native],
|
|
85
|
+
cache: false
|
|
86
|
+
},
|
|
87
|
+
audit: {
|
|
88
|
+
command: AUDIT,
|
|
89
|
+
cache: false
|
|
90
|
+
},
|
|
91
|
+
published: {
|
|
92
|
+
command: "msch-published",
|
|
93
|
+
cache: false
|
|
94
|
+
},
|
|
95
|
+
compat: {
|
|
96
|
+
command: COMPAT,
|
|
97
|
+
cache: false
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
...checks,
|
|
102
|
+
daily: {
|
|
103
|
+
command: DAILY,
|
|
104
|
+
dependsOn: [...workspace.tasks.native],
|
|
105
|
+
cache: false
|
|
106
|
+
},
|
|
107
|
+
verify: {
|
|
108
|
+
command: [],
|
|
109
|
+
dependsOn: [...workspace.tasks.verify, ...Record.keys(checks)]
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
// src/app/repository-text.ts
|
|
114
|
+
const TEXT_IGNORES = [
|
|
115
|
+
"AGENTS.md",
|
|
116
|
+
"CLAUDE.md",
|
|
117
|
+
".agents/skills/**",
|
|
118
|
+
"CHANGELOG.md",
|
|
119
|
+
...exempt
|
|
120
|
+
];
|
|
121
|
+
const QUOTATION = String.raw`/「[^」]*」/`;
|
|
122
|
+
const SENTENCE_LENGTH = 120;
|
|
123
|
+
const KANJI_RUN = 6;
|
|
124
|
+
const PUBLIC_LINES = [
|
|
125
|
+
String.raw`\bCF_BEACON_TOKEN = "[0-9a-f]{32}"`,
|
|
126
|
+
String.raw`\b\w*DISCORD_\w*ID = "[0-9]{17,20}"`,
|
|
127
|
+
String.raw`untrusted comment: minisign public key: [0-9A-F]{16}`
|
|
128
|
+
];
|
|
129
|
+
const EXEMPT_PATHS = [String.raw`(?:^|/)(?:fixtures|upstream)/`];
|
|
130
|
+
const builtRules = (properNouns) => ({
|
|
131
|
+
"@textlint-ja/preset-ai-writing": true,
|
|
132
|
+
"@r_masseater/preset-ja": true,
|
|
133
|
+
"preset-ja-technical-writing": {
|
|
134
|
+
"sentence-length": { max: SENTENCE_LENGTH },
|
|
135
|
+
"ja-no-mixed-period": { allowPeriodMarks: [":"] },
|
|
136
|
+
"no-mix-dearu-desumasu": {
|
|
137
|
+
preferInBody: "である",
|
|
138
|
+
preferInList: "である"
|
|
139
|
+
},
|
|
140
|
+
"max-kanji-continuous-len": {
|
|
141
|
+
max: KANJI_RUN,
|
|
142
|
+
allow: [...properNouns]
|
|
143
|
+
},
|
|
144
|
+
"no-exclamation-question-mark": { allow: [QUOTATION, ...properNouns] }
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const builtTextRuleNames = Record.keys(builtRules([]));
|
|
148
|
+
const textlintOf = ({ properNouns = [], rules = {}, sources = [] }) => {
|
|
149
|
+
const textRules = {
|
|
150
|
+
...rules,
|
|
151
|
+
...builtRules(properNouns)
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
ignores: TEXT_IGNORES,
|
|
155
|
+
presets: textlintPresets,
|
|
156
|
+
filterModules: textlintFilters,
|
|
157
|
+
reportUnusedDirectives: true,
|
|
158
|
+
sources: pipe(sources, Array.map(({ files, plugins }) => ({
|
|
159
|
+
files: [...files],
|
|
160
|
+
plugins: { ...plugins },
|
|
161
|
+
rules: textRules,
|
|
162
|
+
filters: { comments: true }
|
|
163
|
+
}))),
|
|
164
|
+
filters: { comments: true },
|
|
165
|
+
rules: textRules
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
const anyOf = (subject) => (patterns) => {
|
|
169
|
+
if (Array.isReadonlyArrayEmpty(patterns)) return [];
|
|
170
|
+
return [`matchesAny(${subject}, [${pipe(patterns, Array.map((pattern) => `\`${pattern}\``), Array.join(", "))}])`];
|
|
171
|
+
};
|
|
172
|
+
const secretsOf = () => ({
|
|
173
|
+
extend: { path: betterleaks },
|
|
174
|
+
filter: pipe([...anyOf("finding.line")(PUBLIC_LINES), ...anyOf(`attributes["path"]`)(EXEMPT_PATHS)], Array.join(" || "))
|
|
175
|
+
});
|
|
176
|
+
export { MSCH_TASK_COMMANDS as a, textlintOf as i, builtTextRuleNames as n, tasksOf as o, secretsOf as r, TEXT_IGNORES as t };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=repository-text-DGfYd5Wq.mjs.map
|