@r_masseater/msch 0.41.0 → 0.42.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.
Files changed (41) hide show
  1. package/README.md +7 -0
  2. package/dist/cargo-inputs.d.mts +14 -0
  3. package/dist/cargo-inputs.mjs +226 -0
  4. package/dist/cargo-inputs.mjs.map +1 -0
  5. package/dist/{cli-contract-8SnKqhGw.mjs → cli-contract-DdTV5DaG.mjs} +2 -2
  6. package/dist/{cli-contract-8SnKqhGw.mjs.map → cli-contract-DdTV5DaG.mjs.map} +1 -1
  7. package/dist/cli.mjs +475 -462
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/config.d.mts +2 -2
  10. package/dist/config.mjs +9 -6
  11. package/dist/config.mjs.map +1 -1
  12. package/dist/decision-rules.d.mts +1 -1
  13. package/dist/decision-rules.mjs +1 -1
  14. package/dist/{define-lint-preset-BYMl7wof.mjs → define-lint-preset-DKJku2ZR.mjs} +124 -85
  15. package/dist/define-lint-preset-DKJku2ZR.mjs.map +1 -0
  16. package/dist/ignored-directories-CfACwIvu.mjs +50 -0
  17. package/dist/ignored-directories-CfACwIvu.mjs.map +1 -0
  18. package/dist/{index-lM4Pphgz.d.mts → index-BwiAHe_u.d.mts} +21 -16
  19. package/dist/{index-CcVKuHBw.d.mts → index-DdJXnW1q.d.mts} +2 -2
  20. package/dist/lint.d.mts +2 -2
  21. package/dist/lint.mjs +1 -1
  22. package/dist/oxlint.mjs +1 -1
  23. package/dist/{package-A62qq8pE.mjs → package-vbK0Qycn.mjs} +2 -2
  24. package/dist/{package-A62qq8pE.mjs.map → package-vbK0Qycn.mjs.map} +1 -1
  25. package/dist/publish.d.mts +1 -0
  26. package/dist/publish.mjs +578 -0
  27. package/dist/publish.mjs.map +1 -0
  28. package/dist/{repository-files-CorshdqY.mjs → repository-files-CPfBA4mf.mjs} +7 -1
  29. package/dist/repository-files-CPfBA4mf.mjs.map +1 -0
  30. package/dist/runtime-Dc5gCUSF.mjs +29 -0
  31. package/dist/runtime-Dc5gCUSF.mjs.map +1 -0
  32. package/dist/workspace-settings.d.mts +1 -1
  33. package/dist/workspace-settings.mjs +6 -63
  34. package/dist/workspace-settings.mjs.map +1 -1
  35. package/package.json +17 -7
  36. package/skills/msch-checks/SKILL.md +0 -5
  37. package/skills/publishing/SKILL.md +44 -0
  38. package/skills/repository-config/SKILL.md +8 -7
  39. package/src/app/vite.d.ts +4 -0
  40. package/dist/define-lint-preset-BYMl7wof.mjs.map +0 -1
  41. package/dist/repository-files-CorshdqY.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.mjs","names":["taggedError","Arr","Str","taggedError","Rec","Arr","MANIFEST_FILE","Str","Rec","Arr","Str","Rec","Arr","Str","Rec","Arr","Arr"],"sources":["../../github-workflow/src/shared/api/github.ts","../../github-workflow/src/shared/lib/process.ts","../../github-workflow/src/shared/lib/workflow.ts","../src/features/publish-workspace/model/manifest.ts","../src/features/publish-workspace/model/platforms.ts","../src/features/publish-workspace/model/plan.ts","../src/features/publish-workspace/model/npm.ts","../src/features/publish-workspace/model/release.ts","../bin/msch-publish.ts"],"sourcesContent":["import { Config, Effect, Redacted } from \"effect\";\nimport type { Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\nimport type { HttpBody, HttpClientError, HttpMethod } from \"effect/http\";\n\nconst API = \"https://api.github.com\";\nconst HEADERS = {\n accept: \"application/vnd.github+json\",\n \"user-agent\": \"masseater.dev\",\n \"x-github-api-version\": \"2022-11-28\",\n};\n\ntype Failure = Config.ConfigError | HttpBody.HttpBodyError | HttpClientError.HttpClientError;\n\ntype Sent<Success> = Effect.Effect<Success, Failure, HttpClient.HttpClient>;\n\nconst requestTo = Effect.fn(\"requestTo\")(function* requestTo(\n method: HttpMethod.HttpMethod,\n path: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const token = yield* Config.Redacted(\"GH_TOKEN\").pipe(\n Config.orElse(() => Config.Redacted(\"GITHUB_TOKEN\")),\n );\n return HttpClientRequest.make(method)(`${API}/repos/${repository}/${path}`).pipe(\n HttpClientRequest.bearerToken(Redacted.value(token)),\n HttpClientRequest.setHeaders(HEADERS),\n );\n});\n\nconst execute = Effect.fn(\"execute\")(function* execute(\n request: HttpClientRequest.HttpClientRequest,\n) {\n const client = yield* HttpClient.HttpClient;\n const response = yield* client.execute(request);\n return yield* HttpClientResponse.filterStatusOk(response);\n});\n\nconst withBody = Effect.fn(\"withBody\")(function* withBody(\n method: HttpMethod.HttpMethod.WithBody,\n path: string,\n body: unknown,\n) {\n const request = yield* requestTo(method, path);\n const filled = yield* HttpClientRequest.bodyJson(request, body);\n return yield* execute(filled);\n});\n\nconst getJsonOf =\n <Codec extends Schema.Constraint>(schema: Codec) =>\n (\n path: string,\n ): Effect.Effect<\n Codec[\"Type\"],\n Failure | Schema.SchemaError,\n HttpClient.HttpClient | Codec[\"DecodingServices\"]\n > =>\n requestTo(\"GET\", path).pipe(\n Effect.flatMap(execute),\n Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)),\n );\n\nconst postJsonOf =\n <Codec extends Schema.Constraint>(schema: Codec) =>\n ({\n path,\n body,\n }: Write): Effect.Effect<\n Codec[\"Type\"],\n Failure | Schema.SchemaError,\n HttpClient.HttpClient | Codec[\"DecodingServices\"]\n > =>\n withBody(\"POST\", path, body).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)));\n\nconst removeAt = (path: string): Sent<void> =>\n requestTo(\"DELETE\", path).pipe(Effect.flatMap(execute), Effect.asVoid);\n\ninterface Write {\n readonly path: string;\n readonly body: unknown;\n}\n\nconst postTo = ({ path, body }: Write): Sent<void> =>\n withBody(\"POST\", path, body).pipe(Effect.asVoid);\n\nconst patchAt = ({ path, body }: Write): Sent<void> =>\n withBody(\"PATCH\", path, body).pipe(Effect.asVoid);\n\n/** @internal */\nexport const getJson = getJsonOf;\n\n/** @internal */\nexport const remove = removeAt;\n\n/** @internal */\nexport const post = postTo;\n\n/** @internal */\nexport const patch = patchAt;\n\n/** @internal */\nexport const postJson = postJsonOf;\n","import { Array as Arr, Effect, Schema, Stream, String as Str } from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nconst SUCCESS = 0;\n\nconst taggedError = Schema.TaggedError;\n\nexport class CommandFailed extends taggedError<CommandFailed, { readonly brand: unique symbol }>()(\n \"CommandFailed\",\n { message: Schema.String },\n) {}\n\nexport interface Command {\n readonly command: string;\n readonly args: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly cwd?: string;\n}\n\ntype Spawned<Success> = Effect.Effect<\n Success,\n CommandFailed | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n>;\n\nconst failed = ({ command, args }: Command): CommandFailed =>\n CommandFailed.make({ message: `${command} ${Arr.join(args, \" \")} failed` });\n\nconst exitCodeOf = Effect.fn(\"exitCodeOf\")(function* exitCodeOf({\n command,\n args,\n env,\n cwd,\n}: Command) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n return yield* spawner.exitCode(\n ChildProcess.make(command, args, {\n cwd,\n env,\n extendEnv: true,\n stdin: \"ignore\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n});\n\nconst succeedsWith = (command: Command): Spawned<boolean> =>\n exitCodeOf(command).pipe(Effect.map((code) => code === SUCCESS));\n\nconst mustSucceedWith = (command: Command): Spawned<void> =>\n succeedsWith(command).pipe(\n Effect.filterOrFail(\n (passed) => passed,\n () => failed(command),\n ),\n Effect.asVoid,\n );\n\nconst collected = Effect.fn(\"collected\")(function* collected({ command, args, env, cwd }: Command) {\n const handle = yield* ChildProcess.make(command, args, {\n cwd,\n env,\n extendEnv: true,\n stdin: \"ignore\",\n stderr: \"inherit\",\n });\n const [output, code] = yield* Effect.all(\n [handle.stdout.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n return { output, code };\n});\n\nconst outputWith = (command: Command): Spawned<string> =>\n collected(command).pipe(\n Effect.scoped,\n Effect.filterOrFail(\n ({ code }) => code === SUCCESS,\n () => failed(command),\n ),\n Effect.map(({ output }) => Str.trim(output)),\n );\n\n/** @internal */\nexport const succeeds = succeedsWith;\n\n/** @internal */\nexport const mustSucceed = mustSucceedWith;\n\nconst finishedWith = (command: Command): Spawned<Readonly<{ output: string; code: number }>> =>\n Effect.scoped(collected(command));\n\n/** @internal */\nexport const outputOf = outputWith;\n\n/** @internal */\nexport const finished = finishedWith;\n","import {\n Array as Arr,\n Config,\n Console,\n Effect,\n FileSystem,\n Record as Rec,\n Schema,\n pipe,\n} from \"effect\";\nimport type { PlatformError } from \"effect\";\n\ntype Appended = Effect.Effect<\n void,\n Config.ConfigError | PlatformError.PlatformError,\n FileSystem.FileSystem\n>;\n\nconst taggedError = Schema.TaggedError;\n\nexport class WorkflowFailed extends taggedError<\n WorkflowFailed,\n { readonly brand: unique symbol }\n>()(\"WorkflowFailed\", { message: Schema.String }) {}\n\nconst appendTo = (variable: string, entries: Readonly<Record<string, string>>): Appended =>\n Effect.gen(function* appended() {\n const path = yield* Config.String(variable);\n const fs = yield* FileSystem.FileSystem;\n const lines = pipe(\n Rec.toEntries(entries),\n Arr.map(([name, value]) => `${name}=${value}\\n`),\n Arr.join(\"\"),\n );\n yield* fs.writeFileString(path, lines, { flag: \"a\" });\n });\n\nconst outputsOf = (outputs: Readonly<Record<string, string>>): Appended =>\n appendTo(\"GITHUB_OUTPUT\", outputs);\n\nconst envOf = (variables: Readonly<Record<string, string>>): Appended =>\n appendTo(\"GITHUB_ENV\", variables);\n\n/** @internal */\nexport const writeOutputs = outputsOf;\n\n/** @internal */\nexport const setEnv = envOf;\n\nexport const warn = (message: string): Effect.Effect<void> => Console.log(`::warning::${message}`);\n\nexport const mask = (value: string): Effect.Effect<void> => Console.log(`::add-mask::${value}`);\n\nexport const fail = Effect.fn(\"fail\")(function* fail(message: string) {\n yield* Console.log(`::error::${message}`);\n return yield* WorkflowFailed.make({ message });\n});\n","import { Effect, FileSystem, Option, Path, Schema, String as Str, pipe } from \"effect\";\n\nconst MANIFEST_FILE = \"package.json\";\nconst SCOPE = /^@[^/]+\\//u;\nconst UNVERSIONED = \"0.0.0\";\n\nconst Native = Schema.Struct({ binary: Schema.String, targets: Schema.Array(Schema.String) });\n\nconst ManifestSchema = Schema.Struct({\n name: Schema.String,\n version: Schema.String,\n private: Schema.optionalKey(Schema.Boolean),\n native: Schema.optionalKey(Native),\n \"size-limit\": Schema.optionalKey(Schema.Unknown),\n});\n\n/** @internal */\nexport type Manifest = typeof ManifestSchema.Type;\n\n/** @internal */\nexport const manifestIn = Effect.fn(\"publish.manifest\")(function* manifestIn(directory: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE));\n return yield* Schema.decodeEffect(Schema.fromJsonString(ManifestSchema))(text);\n});\n\n/** @internal */\nexport const releaseName = ({ name }: Pick<Manifest, \"name\">): string =>\n Str.replace(SCOPE, \"\")(name);\n\n/** @internal */\nexport const tagOf = (manifest: Pick<Manifest, \"name\" | \"version\">): string =>\n `${releaseName(manifest)}-v${manifest.version}`;\n\n/** @internal */\nexport const environmentOf = (manifest: Pick<Manifest, \"name\">): string =>\n `${releaseName(manifest)}-release`;\n\n/** @internal */\nexport const isVersioned = ({ version }: Pick<Manifest, \"version\">): boolean =>\n version !== UNVERSIONED;\n\n/** @internal */\nexport const goesToNpm = (manifest: Pick<Manifest, \"private\">): boolean =>\n !pipe(\n Option.fromUndefinedOr(manifest.private),\n Option.getOrElse(() => false),\n );\n","import { Array as Arr, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nconst RUNNERS = {\n linux: \"ubuntu-latest\",\n windows: \"windows-latest\",\n macos: \"macos-latest\",\n} as const satisfies Readonly<Record<string, string>>;\n\ntype Os = keyof typeof RUNNERS;\n\nconst NODE_PLATFORMS: Readonly<Record<string, Os>> = {\n linux: \"linux\",\n win32: \"windows\",\n darwin: \"macos\",\n};\n\nconst BUILD = \"release:\";\nconst CHECK = \"release:check:\";\nconst LIBC: Readonly<Record<string, string>> = { gnu: \"glibc\", musl: \"musl\" };\nconst CPU_INDEX = 1;\nconst ABI_INDEX = 2;\n\n/** @internal */\nexport interface Runner {\n readonly os: string;\n readonly runner: string;\n}\n\n/** @internal */\nexport interface NativeTarget {\n readonly target: string;\n readonly runner: string;\n}\n\nconst systems = Rec.keys(RUNNERS);\n\nconst runnersFor = (tasks: readonly string[], prefix: string): readonly Runner[] =>\n pipe(\n systems,\n Arr.filter((os) => Arr.contains(tasks, `${prefix}${os}`)),\n Arr.map((os): Runner => ({ os, runner: RUNNERS[os] })),\n );\n\n/** @internal */\nexport const buildsOf = (tasks: readonly string[]): readonly Runner[] => runnersFor(tasks, BUILD);\n\n/** @internal */\nexport const checksOf = (tasks: readonly string[]): readonly Runner[] => runnersFor(tasks, CHECK);\n\n/** @internal */\nexport const nativeTargetsOf = (targets: readonly string[]): readonly NativeTarget[] =>\n pipe(\n targets,\n Arr.flatMap((target) =>\n pipe(\n Arr.head(Str.split(target, \"-\")),\n Option.flatMap((platform) => Rec.get(NODE_PLATFORMS, platform)),\n Option.map((os): NativeTarget => ({ target, runner: RUNNERS[os] })),\n Option.toArray,\n ),\n ),\n );\n\n/** @internal */\nexport interface NativePackage {\n readonly name: string;\n readonly version: string;\n readonly binary: string;\n readonly target: string;\n}\n\nconst libcOf = (parts: readonly string[]): Readonly<Record<string, readonly string[]>> =>\n pipe(\n Arr.get(parts, ABI_INDEX),\n Option.flatMap((abi) => Rec.get(LIBC, abi)),\n Option.match({ onNone: () => ({}), onSome: (libc) => ({ libc: [libc] }) }),\n );\n\n/** @internal */\nexport const nativeFileOf = ({ binary, target }: NativePackage): string =>\n `${binary}.${target}.node`;\n\n/** @internal */\nexport const nativeFields = (native: NativePackage): Readonly<Record<string, unknown>> => {\n const parts = Str.split(native.target, \"-\");\n const file = nativeFileOf(native);\n return {\n name: `${native.name}-${native.target}`,\n version: native.version,\n os: Option.toArray(Arr.head(parts)),\n cpu: Option.toArray(Arr.get(parts, CPU_INDEX)),\n ...libcOf(parts),\n main: file,\n files: [file],\n };\n};\n\n/** @internal */\nexport const nativeReadme = ({ name, target }: NativePackage): string =>\n `# ${name}-${target}\\n\\nThe prebuilt ${target} native addon of [${name}](https://www.npmjs.com/package/${name}). Install ${name} instead; npm picks this package for your platform.\\n`;\n","import { outputOf, succeeds, writeOutputs } from \"@masseater.dev/github-workflow\";\nimport {\n Array as Arr,\n Config,\n Effect,\n Option,\n Path,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport {\n environmentOf,\n goesToNpm,\n isVersioned,\n manifestIn,\n releaseName,\n tagOf,\n} from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { buildsOf, checksOf, nativeTargetsOf } from \"./platforms.ts\";\n\nconst HOOK = \"release:publish\";\nconst NONE = 0;\nconst TRAILING_SLASH = /\\/$/u;\n\nconst Task = Schema.Struct({ package: Schema.String, name: Schema.String });\n\nconst TaskGraph = Schema.fromJsonString(\n Schema.Struct({ workspaceRoot: Schema.String, tasks: Schema.Record(Schema.String, Task) }),\n);\n\nconst Runner = Schema.Struct({ os: Schema.String, runner: Schema.String });\n\nconst NativeTarget = Schema.Struct({ target: Schema.String, runner: Schema.String });\n\nconst PlanSchema = Schema.Struct({\n directory: Schema.String,\n name: Schema.String,\n version: Schema.String,\n tag: Schema.String,\n environment: Schema.String,\n npm: Schema.Boolean,\n native: Schema.Array(NativeTarget),\n builds: Schema.Array(Runner),\n checks: Schema.Array(Runner),\n release: Schema.Boolean,\n hook: Schema.Boolean,\n});\n\n/** @internal */\nexport type Plan = typeof PlanSchema.Type;\n\nconst AssetCount = Schema.fromJsonString(Schema.Finite);\n\n/** @internal */\nexport interface Published {\n readonly directory: string;\n readonly name: string;\n readonly version: string;\n}\n\nconst tasksOf = Effect.fn(\"publish.tasks\")(function* tasksOf(directory: string) {\n const text = yield* outputOf({ command: \"vp\", args: [\"run\", \"--json\"] });\n const graph = yield* Schema.decodeEffect(TaskGraph)(text);\n return pipe(\n Rec.values(graph.tasks),\n Arr.filter((task) => task.package === directory),\n Arr.map(({ name }) => name),\n );\n});\n\n/** @internal */\nexport const onNpm = ({ directory, name, version }: Published): ReturnType<typeof succeeds> =>\n succeeds({ command: \"npm\", args: [\"view\", `${name}@${version}`, \"version\"], cwd: directory });\n\n/** @internal */\nexport const releasedWithAssets = Effect.fn(\"publish.releasedWithAssets\")(\n function* releasedWithAssets(tag: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const view = [\"release\", \"view\", tag, \"--repo\", repository];\n const exists = yield* succeeds({ command: \"gh\", args: view });\n if (!exists) {\n return false;\n }\n const count = yield* outputOf({\n command: \"gh\",\n args: [...view, \"--json\", \"assets\", \"--jq\", \".assets | length\"],\n }).pipe(Effect.flatMap(Schema.decodeEffect(AssetCount)));\n return count > NONE;\n },\n);\n\nconst keepWhen =\n (kept: boolean) =>\n <Item>(items: readonly Item[]): readonly Item[] =>\n pipe(\n items,\n Arr.filter(() => kept),\n );\n\nconst needsNpm = Effect.fn(\"publish.needsNpm\")(function* needsNpm(\n directory: string,\n manifest: Manifest,\n) {\n if (!goesToNpm(manifest)) {\n return false;\n }\n const published = yield* onNpm({ directory, ...manifest });\n return !published;\n});\n\nconst needsRelease = Effect.fn(\"publish.needsRelease\")(function* needsRelease(\n manifest: Manifest,\n builds: readonly unknown[],\n) {\n if (!isVersioned(manifest) || Arr.isReadonlyArrayEmpty(builds)) {\n return false;\n }\n const released = yield* releasedWithAssets(tagOf(manifest));\n return !released;\n});\n\nconst nativeOf = (manifest: Manifest): readonly (typeof NativeTarget.Type)[] =>\n pipe(\n Option.fromUndefinedOr(manifest.native),\n Option.map(({ targets }) => nativeTargetsOf(targets)),\n Option.getOrElse((): readonly (typeof NativeTarget.Type)[] => []),\n );\n\n/** @internal */\nexport const planOf = Effect.fn(\"publish.plan\")(function* planOf(directory: string) {\n const path = yield* Path.Path;\n const workspace = Str.replace(TRAILING_SLASH, \"\")(path.normalize(directory));\n const manifest = yield* manifestIn(workspace);\n const tasks = yield* tasksOf(workspace);\n const npm = yield* needsNpm(workspace, manifest);\n const release = yield* needsRelease(manifest, buildsOf(tasks));\n const built = keepWhen(release || !isVersioned(manifest));\n return {\n directory: workspace,\n name: releaseName(manifest),\n version: manifest.version,\n tag: tagOf(manifest),\n environment: environmentOf(manifest),\n npm,\n native: keepWhen(npm)(nativeOf(manifest)),\n builds: built(buildsOf(tasks)),\n checks: built(checksOf(tasks)),\n release,\n hook: release && Arr.contains(tasks, HOOK),\n } satisfies Plan;\n});\n\n/** @internal */\nexport const writePlan = Effect.fn(\"publish.writePlan\")(function* writePlan(plan: Plan) {\n const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(PlanSchema))(plan);\n yield* Effect.logInfo(encoded);\n yield* writeOutputs({ plan: encoded });\n});\n","import { mask, mustSucceed } from \"@masseater.dev/github-workflow\";\nimport {\n Array as Arr,\n Config,\n Console,\n Effect,\n FileSystem,\n Option,\n Path,\n Predicate,\n Record as Rec,\n Redacted,\n Schema,\n pipe,\n} from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\n\nimport { manifestIn } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { onNpm } from \"./plan.ts\";\nimport { nativeFields, nativeFileOf, nativeReadme } from \"./platforms.ts\";\nimport type { NativePackage } from \"./platforms.ts\";\n\nconst BROKER = \"https://credentials.masseater.dev/\";\nconst AUDIENCE = \"masseater-dev-credential-broker\";\nconst TARBALL = \"package.tgz\";\nconst NPM_DIR = \"npm\";\nconst NATIVE_DIR = \"native\";\nconst MANIFEST_FILE = \"package.json\";\nconst KEPT_FIELDS: readonly string[] = [\"license\", \"repository\", \"homepage\", \"bugs\", \"engines\"];\nconst PUBLISH_FLAGS = [\"--provenance\", \"--access\", \"public\"];\n\ntype Env = Readonly<Record<string, string>>;\n\nconst PackageJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));\nconst PlatformManifest = Schema.fromJsonString(\n Schema.Struct({ name: Schema.String, version: Schema.String }),\n);\nconst IdToken = Schema.Struct({ value: Schema.String });\nconst Grants = Schema.Struct({ npmToken: Schema.optional(Schema.String) });\n\nconst oidcToken = Effect.fn(\"publish.oidc\")(function* oidcToken(\n requestUrl: string,\n requestToken: Redacted.Redacted,\n) {\n const client = yield* HttpClient.HttpClient;\n const request = HttpClientRequest.get(`${requestUrl}&audience=${AUDIENCE}`).pipe(\n HttpClientRequest.bearerToken(Redacted.value(requestToken)),\n );\n const response = yield* HttpClient.filterStatusOk(client).execute(request);\n const { value } = yield* HttpClientResponse.schemaBodyJson(IdToken)(response);\n yield* mask(value);\n return value;\n});\n\nconst brokerToken = Effect.fn(\"publish.brokerToken\")(function* brokerToken(oidc: string) {\n const client = yield* HttpClient.HttpClient;\n const request = HttpClientRequest.post(BROKER).pipe(HttpClientRequest.bearerToken(oidc));\n const response = yield* HttpClient.filterStatusOk(client).execute(request);\n const grants = yield* HttpClientResponse.schemaBodyJson(Grants)(response);\n const token = Option.fromUndefinedOr(grants.npmToken);\n yield* Effect.forEach(Option.toArray(token), mask, { concurrency: 1, discard: true });\n return token;\n});\n\nconst authEnv = Effect.fn(\"publish.authEnv\")(function* authEnv() {\n const requestUrl = yield* Config.option(Config.String(\"ACTIONS_ID_TOKEN_REQUEST_URL\"));\n const requestToken = yield* Config.option(Config.Redacted(\"ACTIONS_ID_TOKEN_REQUEST_TOKEN\"));\n if (Option.isNone(requestUrl) || Option.isNone(requestToken)) {\n return {} satisfies Env;\n }\n const token = yield* oidcToken(requestUrl.value, requestToken.value).pipe(\n Effect.flatMap(brokerToken),\n Effect.tapError(() =>\n Console.log(\"The credential broker gave no npm token; npm uses Trusted Publishing alone\"),\n ),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return Option.match(token, {\n onNone: (): Env => ({}),\n onSome: (value): Env => ({ NODE_AUTH_TOKEN: value }),\n });\n});\n\nconst verifyPackage = Effect.fn(\"publish.verify\")(function* verifyPackage(\n directory: string,\n manifest: Manifest,\n) {\n const size = pipe(\n Option.fromUndefinedOr(manifest[\"size-limit\"]),\n Option.map(() => \"size\"),\n Option.toArray,\n );\n const tasks = [\"build\", \"test\", ...size];\n yield* Effect.forEach(\n tasks,\n (task) => mustSucceed({ command: \"vp\", args: [\"run\", task], cwd: directory }),\n { concurrency: 1, discard: true },\n );\n});\n\nconst keptFields = Effect.fn(\"publish.keptFields\")(function* keptFields(directory: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE));\n const raw = yield* Schema.decodeEffect(PackageJson)(text);\n return pipe(\n raw,\n Rec.filter((_value, key) => Arr.contains(KEPT_FIELDS, key)),\n );\n});\n\nconst writeNative = Effect.fn(\"publish.writeNative\")(function* writeNative(\n directory: string,\n native: NativePackage,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const kept = yield* keptFields(directory);\n const target = path.resolve(directory, NPM_DIR, native.target);\n const file = nativeFileOf(native);\n yield* fileSystem.makeDirectory(target, { recursive: true });\n yield* fileSystem.copyFile(path.join(directory, NATIVE_DIR, file), path.join(target, file));\n const text = yield* Schema.encodeEffect(PackageJson)({ ...kept, ...nativeFields(native) });\n yield* Effect.all(\n [\n fileSystem.writeFileString(path.join(target, MANIFEST_FILE), text),\n fileSystem.writeFileString(path.join(target, \"README.md\"), nativeReadme(native)),\n ],\n { concurrency: \"unbounded\" },\n );\n return target;\n});\n\nconst publishNative = Effect.fn(\"publish.publishNative\")(function* publishNative(\n target: string,\n env: Env,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const { name, version } = yield* fileSystem\n .readFileString(path.join(target, MANIFEST_FILE))\n .pipe(Effect.flatMap(Schema.decodeEffect(PlatformManifest)));\n if (yield* onNpm({ directory: target, name, version })) {\n yield* Console.log(`${name}@${version} is already published, skipping`);\n return name;\n }\n yield* mustSucceed({\n command: \"npm\",\n args: [\"publish\", \".\", ...PUBLISH_FLAGS],\n env,\n cwd: target,\n });\n return name;\n});\n\nconst addOptionalDependencies = Effect.fn(\"publish.optionalDependencies\")(\n function* addOptionalDependencies(directory: string, names: readonly string[], version: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const file = path.join(directory, MANIFEST_FILE);\n const manifest = yield* fileSystem\n .readFileString(file)\n .pipe(Effect.flatMap(Schema.decodeEffect(PackageJson)));\n const optionalDependencies = pipe(\n names,\n Arr.map((name): readonly [string, string] => [name, version]),\n Rec.fromEntries,\n );\n const updated = yield* Schema.encodeEffect(PackageJson)({ ...manifest, optionalDependencies });\n yield* fileSystem.writeFileString(file, updated);\n },\n);\n\nconst publishNatives = Effect.fn(\"publish.publishNatives\")(function* publishNatives(\n directory: string,\n manifest: Manifest,\n env: Env,\n) {\n if (Predicate.isUndefined(manifest.native)) {\n return;\n }\n const { binary, targets } = manifest.native;\n const written = yield* Effect.forEach(\n targets,\n (target) =>\n writeNative(directory, { name: manifest.name, version: manifest.version, binary, target }),\n { concurrency: 1 },\n );\n const names = yield* Effect.forEach(written, (target) => publishNative(target, env), {\n concurrency: 1,\n });\n yield* addOptionalDependencies(directory, names, manifest.version);\n});\n\nconst pack = Effect.fn(\"publish.pack\")(function* pack(directory: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const temporary = yield* fileSystem.makeTempDirectoryScoped();\n const tarball = path.join(temporary, TARBALL);\n yield* mustSucceed({ command: \"vp\", args: [\"pm\", \"pack\", \"--out\", tarball], cwd: directory });\n return tarball;\n});\n\n/** @internal */\nexport const publishToNpm = Effect.fn(\"publish.npm\")(function* publishToNpm(directory: string) {\n const manifest = yield* manifestIn(directory);\n if (yield* onNpm({ directory, ...manifest })) {\n return yield* Console.log(`${manifest.name}@${manifest.version} is already published`);\n }\n const env = yield* authEnv();\n yield* verifyPackage(directory, manifest);\n yield* publishNatives(directory, manifest, env);\n const tarball = yield* pack(directory);\n return yield* mustSucceed({\n command: \"npm\",\n args: [\"publish\", tarball, ...PUBLISH_FLAGS],\n env,\n cwd: directory,\n });\n}, Effect.scoped);\n","import { mustSucceed, succeeds, writeOutputs } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Config, Effect, FileSystem, Order, Path, pipe } from \"effect\";\n\nimport { isVersioned, manifestIn, releaseName, tagOf } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { releasedWithAssets } from \"./plan.ts\";\n\nconst ASSETS = \"release-assets\";\n\nconst tagRevision = Effect.fn(\"publish.tag\")(function* tagRevision(tag: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const sha = yield* Config.String(\"GITHUB_SHA\");\n const exists = yield* succeeds({\n command: \"gh\",\n args: [\"api\", `repos/${repository}/git/ref/tags/${tag}`],\n });\n if (exists) {\n return;\n }\n yield* mustSucceed({\n command: \"gh\",\n args: [\n \"api\",\n \"-X\",\n \"POST\",\n `repos/${repository}/git/refs`,\n \"-f\",\n `ref=refs/tags/${tag}`,\n \"-f\",\n `sha=${sha}`,\n ],\n });\n});\n\nconst assetsIn = Effect.fn(\"publish.assets\")(function* assetsIn(directory: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const folder = path.join(directory, ASSETS);\n if (!(yield* fileSystem.exists(folder))) {\n return [];\n }\n const names = yield* fileSystem.readDirectory(folder, { recursive: true });\n const files = yield* Effect.filter(\n pipe(\n names,\n Arr.map((name) => path.join(folder, name)),\n ),\n (file) =>\n fileSystem.stat(file).pipe(\n Effect.map(({ type }) => type === \"File\"),\n Effect.orElseSucceed(() => false),\n ),\n );\n return Arr.sort(files, Order.String);\n});\n\nconst createRelease = Effect.fn(\"publish.createRelease\")(function* createRelease(\n tag: string,\n title: string,\n) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const exists = yield* succeeds({\n command: \"gh\",\n args: [\"release\", \"view\", tag, \"--repo\", repository],\n });\n if (exists) {\n return;\n }\n yield* mustSucceed({\n command: \"gh\",\n args: [\n \"release\",\n \"create\",\n tag,\n \"--repo\",\n repository,\n \"--verify-tag\",\n \"--latest=false\",\n \"--title\",\n title,\n \"--notes\",\n \"\",\n ],\n });\n});\n\nconst uploadAssets = Effect.fn(\"publish.uploadAssets\")(function* uploadAssets(\n directory: string,\n manifest: Manifest,\n) {\n const tag = tagOf(manifest);\n const files = yield* assetsIn(directory);\n if (Arr.isReadonlyArrayEmpty(files) || (yield* releasedWithAssets(tag))) {\n return;\n }\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n yield* createRelease(tag, `${releaseName(manifest)} v${manifest.version}`);\n yield* mustSucceed({\n command: \"gh\",\n args: [\"release\", \"upload\", tag, ...files, \"--repo\", repository, \"--clobber\"],\n });\n});\n\n/** @internal */\nexport const publishRelease = Effect.fn(\"publish.release\")(function* publishRelease(\n directory: string,\n) {\n const manifest = yield* manifestIn(directory);\n if (!isVersioned(manifest)) {\n yield* Effect.logInfo(`${manifest.name} has no version to publish`);\n return;\n }\n const tag = tagOf(manifest);\n yield* tagRevision(tag);\n yield* writeOutputs({ tag });\n yield* uploadAssets(directory, manifest);\n});\n","#!/usr/bin/env node\nimport { Effect, Schema, Stdio } from \"effect\";\n\nimport { runCli } from \"#/app/runtime.ts\";\nimport {\n planOf,\n publishRelease,\n publishToNpm,\n writePlan,\n} from \"#/features/publish-workspace/index.ts\";\n\nconst Arguments = Schema.Union([\n Schema.Tuple([Schema.Literal(\"plan\"), Schema.String]),\n Schema.Tuple([Schema.Literal(\"npm\"), Schema.String]),\n Schema.Tuple([Schema.Literal(\"release\"), Schema.String]),\n]);\n\nconst taggedError = Schema.TaggedError;\n\nclass UsageError extends taggedError<UsageError, { readonly brand: unique symbol }>()(\n \"UsageError\",\n { message: Schema.String },\n) {}\n\nconst USAGE = \"usage: msch-publish <plan|npm|release> <workspace directory>\";\n\nconst publish = Effect.gen(function* publish() {\n const stdio = yield* Stdio.Stdio;\n const args = yield* stdio.args;\n const [step, directory] = yield* Schema.decodeUnknownEffect(Arguments)(args).pipe(\n Effect.mapError(() => UsageError.make({ message: USAGE })),\n );\n if (step === \"plan\") {\n return yield* planOf(directory).pipe(Effect.flatMap(writePlan));\n }\n if (step === \"npm\") {\n return yield* publishToNpm(directory);\n }\n return yield* publishRelease(directory);\n});\n\nrunCli(publish);\n"],"mappings":";;;;;;;AAKA,MAAM,MAAM;AACZ,MAAM,UAAU;CACd,QAAQ;CACR,cAAc;CACd,wBAAwB;AAC1B;AAMA,MAAM,YAAY,OAAO,GAAG,WAAW,CAAC,CAAC,UAAU,UACjD,QACA,MACA;CACA,MAAM,aAAa,OAAO,OAAO,OAAO,mBAAmB;CAC3D,MAAM,QAAQ,OAAO,OAAO,SAAS,UAAU,CAAC,CAAC,KAC/C,OAAO,aAAa,OAAO,SAAS,cAAc,CAAC,CACrD;CACA,OAAO,kBAAkB,KAAK,MAAM,CAAC,CAAC,GAAG,IAAI,SAAS,WAAW,GAAG,MAAM,CAAC,CAAC,KAC1E,kBAAkB,YAAY,SAAS,MAAM,KAAK,CAAC,GACnD,kBAAkB,WAAW,OAAO,CACtC;AACF,CAAC;AAED,MAAM,UAAU,OAAO,GAAG,SAAS,CAAC,CAAC,UAAU,QAC7C,SACA;CAEA,MAAM,WAAW,QAAO,OADF,WAAW,WAAA,CACF,QAAQ,OAAO;CAC9C,OAAO,OAAO,mBAAmB,eAAe,QAAQ;AAC1D,CAAC;AAEgB,OAAO,GAAG,UAAU,CAAC,CAAC,UAAU,SAC/C,QACA,MACA,MACA;CACA,MAAM,UAAU,OAAO,UAAU,QAAQ,IAAI;CAC7C,MAAM,SAAS,OAAO,kBAAkB,SAAS,SAAS,IAAI;CAC9D,OAAO,OAAO,QAAQ,MAAM;AAC9B,CA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ED,MAAM,cAAc,OAAO;AAE3B,IAAM,aAAN,cAAyB,YAA2D,CAAC,CACnF,cACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ;AAEd,MAAM,UAAU,OAAO,IAAI,UAAU,UAAU;CAE7C,MAAM,OAAO,QAAO,OADC,MAAM,MAAA,CACD;CAC1B,MAAM,CAAC,MAAM,aAAa,OAAO,OAAO,oBAAoB,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,KAC3E,OAAO,eAAe,WAAW,KAAK,EAAE,SAAS,MAAM,CAAC,CAAC,CAC3D;CACA,IAAI,SAAS,QACX,OAAO,OAAO,OAAO,SAAS,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC;CAEhE,IAAI,SAAS,OACX,OAAO,OAAO,aAAa,SAAS;CAEtC,OAAO,OAAO,eAAe,SAAS;AACxC,CAAC;AAED,OAAO,OAAO"}
@@ -9,6 +9,7 @@ const groupOf = (name) => (found) => pipe(Option.fromNullishOr(found), Option.fl
9
9
  const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
10
10
  const MISSING_SIZE = 0;
11
11
  const GENERATED_PATHSPEC = ":(attr:linguist-generated)";
12
+ const OWNED_PATHSPECS = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
12
13
  const LISTED_ARGS = [
13
14
  "--cached",
14
15
  "--others",
@@ -70,6 +71,11 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
70
71
  return RepositoryFiles.of({
71
72
  generatedFiles: (root) => gitFiles(root, ["--", GENERATED_PATHSPEC]).pipe(Effect.map(Array.map((file) => path.join(root, file)))),
72
73
  listedFiles: (root) => gitFiles(root, LISTED_ARGS),
74
+ ownedFiles: (root) => gitFiles(root, [
75
+ ...LISTED_ARGS,
76
+ "--",
77
+ ...OWNED_PATHSPECS
78
+ ]),
73
79
  linkedFiles: (root) => gitFiles(root, STAGED_ARGS).pipe(Effect.map(Array.flatMap(linkName))),
74
80
  readLink: (file) => fs.readLink(file).pipe(Effect.option),
75
81
  mergeBase: (root, revision) => gitText(root, [
@@ -109,4 +115,4 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
109
115
  })).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
110
116
  export { groupOf as a, nodeServicesLayer as i, RepositoryFiles as n, nodeRepositoryFiles as r, NODE_MODULES as t };
111
117
 
112
- //# sourceMappingURL=repository-files-CorshdqY.mjs.map
118
+ //# sourceMappingURL=repository-files-CPfBA4mf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-files-CPfBA4mf.mjs","names":["Str","Arr"],"sources":["../src/shared/lib/match-groups.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["import { Option, pipe } from \"effect\";\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","import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\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 { groupOf } from \"./match-groups.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 GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst OWNED_PATHSPECS = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\"];\nconst IGNORED_ARGS = [\"--others\", \"--ignored\", \"--exclude-standard\"];\nconst STAGED_ARGS = [\"--stage\"];\nconst LINK_ENTRY = /^120000 \\S+ \\d+\\t(?<name>.+)$/u;\n\nexport const NODE_MODULES = \"node_modules\";\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 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 readAtRevision: (\n root: string,\n revision: string,\n name: string,\n ) => Effect.Effect<Option.Option<string>>;\n readonly matchingFiles: (\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\"\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});\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 const gitFiles = (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n gitPaths(root, [\"ls-files\", \"-z\", ...args], \"\\0\");\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n listedFiles: (root) => gitFiles(root, LISTED_ARGS),\n ownedFiles: (root) => gitFiles(root, [...LISTED_ARGS, \"--\", ...OWNED_PATHSPECS]),\n linkedFiles: (root) => gitFiles(root, STAGED_ARGS).pipe(Effect.map(Arr.flatMap(linkName))),\n readLink: (file) => fs.readLink(file).pipe(Effect.option),\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 readAtRevision: (root, revision, name) => gitText(root, [\"show\", `${revision}:${name}`]),\n matchingFiles: (root, pathspecs) => gitFiles(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n ignoredFiles: (root, pathspecs) => gitFiles(root, [...IGNORED_ARGS, \"--\", ...pathspecs]),\n ignoredPaths: (root, paths) => gitPaths(root, [\"check-ignore\", \"--\", ...paths], \"\\n\"),\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":";;;;;AAEA,MAAa,WACV,UACA,UACC,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,SAAS,UAAU,OAAO,cAAc,MAAM,MAAM,CAAC,GAC5D,OAAO,SAAS,WAAW,OAAO,cAAc,OAAO,KAAK,CAAC,CAC/D;;;ACeJ,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;AAEA,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB,CAAC,qCAAqC,oCAAoC;AAClG,MAAM,cAAc;CAAC;CAAY;CAAY;AAAoB;AACjE,MAAM,eAAe;CAAC;CAAY;CAAa;AAAoB;AACnE,MAAM,cAAc,CAAC,SAAS;AAC9B,MAAM,aAAa;AAEnB,MAAa,eAAe;AAE5B,IAAa,kBAAb,cAAqC,QAAQ,QA0C3C,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAEtE,MAAM,UAAU;AAIhB,MAAM,iBAAiB,OAAO,IAAI,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AAC,KAAK,MAAM,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,OAAO,cAAc,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { i as nodeServicesLayer, r as nodeRepositoryFiles } from "./repository-files-CPfBA4mf.mjs";
2
+ import { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from "effect";
3
+ import { runMain } from "@effect/platform-node-shared/NodeRuntime";
4
+ import { FetchHttpClient } from "effect/http";
5
+ import { Otlp, OtlpSerialization } from "effect/observability";
6
+ // src/app/output.ts
7
+ const taggedError = Schema.TaggedError;
8
+ var ProblemsFound = class extends taggedError()("ProblemsFound", { count: Schema.Finite }) {};
9
+ /** @internal */
10
+ const writeStdout = Effect.fn("writeStdout")(function* writeStdout(text) {
11
+ const stdio = yield* Stdio.Stdio;
12
+ yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);
13
+ });
14
+ // src/app/runtime.ts
15
+ const reportFailure = (cause) => Effect.gen(function* report() {
16
+ const stdio = yield* Stdio.Stdio;
17
+ if (Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)))) return;
18
+ yield* Stream.make(`${Cause.pretty(cause)}\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);
19
+ });
20
+ const tracing = Otlp.layerFromConfig({ resource: { serviceName: "msch" } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));
21
+ /** @internal */
22
+ const runCli = (program) => {
23
+ const services = Layer.mergeAll(nodeRepositoryFiles, tracing, FetchHttpClient.layer).pipe(Layer.provideMerge(nodeServicesLayer));
24
+ const main = Layer.build(services).pipe(Effect.flatMap((context) => Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context)), Effect.scoped);
25
+ runMain(main, { disableErrorReporting: true });
26
+ };
27
+ export { ProblemsFound as n, writeStdout as r, runCli as t };
28
+
29
+ //# sourceMappingURL=runtime-Dc5gCUSF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-Dc5gCUSF.mjs","names":[],"sources":["../src/app/output.ts","../src/app/runtime.ts"],"sourcesContent":["import { Effect, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n","import { runMain } from \"@effect/platform-node-shared/NodeRuntime\";\nimport { Cause, Effect, Layer, Option, Schema, Stdio, Stream } from \"effect\";\nimport type { FileSystem, Path } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeRepositoryFiles, nodeServicesLayer } from \"#/shared/lib/repository-files.ts\";\nimport type { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound } from \"./output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const failed = Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)));\n if (failed) {\n return;\n }\n yield* Stream.make(`${Cause.pretty(cause)}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\nconst tracing = Otlp.layerFromConfig({ resource: { serviceName: \"msch\" } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n);\n\n/** @internal */\nexport const runCli = <Value, Failure>(\n program: Effect.Effect<\n Value,\n Failure,\n | RepositoryFiles\n | Stdio.Stdio\n | FileSystem.FileSystem\n | Path.Path\n | ChildProcessSpawner.ChildProcessSpawner\n | HttpClient.HttpClient\n >,\n): void => {\n const services = Layer.mergeAll(nodeRepositoryFiles, tracing, FetchHttpClient.layer).pipe(\n Layer.provideMerge(nodeServicesLayer),\n );\n const main = Layer.build(services).pipe(\n Effect.flatMap((context) =>\n Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context),\n ),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n"],"mappings":";;;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC,CAAC;;AAGH,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC;;ACFD,MAAM,iBACJ,UAEA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAE3B,IADe,MAAM,gBAAgB,KAAK,CAAC,CAAC,KAAK,OAAO,OAAO,OAAO,GAAG,aAAa,CAAC,CAC9E,GACP;CAEF,OAAO,OAAO,KAAK,GAAG,MAAM,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AAC9F,CAAC;AAEH,MAAM,UAAU,KAAK,gBAAgB,EAAE,UAAU,EAAE,aAAa,OAAO,EAAE,CAAC,CAAC,CAAC,KAC1E,MAAM,QAAQ,kBAAkB,SAAS,GACzC,MAAM,QAAQ,gBAAgB,KAAK,CACrC;;AAGA,MAAa,UACX,YAUS;CACT,MAAM,WAAW,MAAM,SAAS,qBAAqB,SAAS,gBAAgB,KAAK,CAAC,CAAC,KACnF,MAAM,aAAa,iBAAiB,CACtC;CACA,MAAM,OAAO,MAAM,MAAM,QAAQ,CAAC,CAAC,KACjC,OAAO,SAAS,YACd,OAAO,eAAe,QAAQ,KAAK,OAAO,SAAS,aAAa,CAAC,GAAG,OAAO,CAC7E,GACA,OAAO,MACT;CACA,QAAQ,MAAM,EAAE,uBAAuB,KAAK,CAAC;AAC/C"}
@@ -1,2 +1,2 @@
1
- import { a as SettingsOptions, c as workspaceSettings, d as WorkspaceTasks, i as RuleSets, l as IgnoredDirectory, n as DevDependencyAllowance, o as WorkspaceLint, r as RuleSet, s as WorkspaceSettings, t as DependencySets, u as ignoredDirectories } from "./index-CcVKuHBw.mjs";
1
+ import { a as SettingsOptions, c as workspaceSettings, d as WorkspaceTasks, i as RuleSets, l as IgnoredDirectory, n as DevDependencyAllowance, o as WorkspaceLint, r as RuleSet, s as WorkspaceSettings, t as DependencySets, u as ignoredDirectories } from "./index-DdJXnW1q.mjs";
2
2
  export { type DependencySets, type DevDependencyAllowance, type IgnoredDirectory, type RuleSet, type RuleSets, type SettingsOptions, type WorkspaceLint, type WorkspaceSettings, type WorkspaceTasks, ignoredDirectories, workspaceSettings };
@@ -1,5 +1,6 @@
1
- import { A as programOf, C as TEST_TASK, D as tasksOf, L as literalOf, M as usedFrom, O as literalSettings, R as nestedValues, T as definesTask, a as publicEntriesOf, c as readManifest, f as deployEntries, g as withoutRelative, h as prefixed, i as EntryManifestJson, j as settingsInvalid, k as merged, n as entriesOf, o as MANIFEST_FILE$1, t as PackEntry, v as workspaceDirectories, x as NO_TASKS } from "./package-A62qq8pE.mjs";
2
- import { n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-CorshdqY.mjs";
1
+ import { A as programOf, C as TEST_TASK, D as tasksOf, L as literalOf, M as usedFrom, O as literalSettings, R as nestedValues, T as definesTask, a as publicEntriesOf, c as readManifest, f as deployEntries, g as withoutRelative, h as prefixed, i as EntryManifestJson, j as settingsInvalid, k as merged, n as entriesOf, o as MANIFEST_FILE$1, t as PackEntry, v as workspaceDirectories, x as NO_TASKS } from "./package-vbK0Qycn.mjs";
2
+ import { n as ignoredDirectories, t as collectIgnoredDirectories } from "./ignored-directories-CfACwIvu.mjs";
3
+ import { n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-CPfBA4mf.mjs";
3
4
  import { Array, Effect, Option, Record, Schema, String, pipe } from "effect";
4
5
  // src/features/build-workspace-settings/model/shadcn-ui.ts
5
6
  const MANIFEST_FILE = "package.json";
@@ -25,66 +26,6 @@ const shadcnUiIn = Effect.fn("shadcnUiIn")(function* shadcnUiIn(root, name) {
25
26
  const imports = pipe(manifestText, Option.flatMap(decodeManifestImports), Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)));
26
27
  return pipe(configText, Option.flatMap(decodeShadcnConfig), Option.map(({ aliases }) => pipe(imports, Option.flatMap((map) => resolvedAlias(map, aliases.ui)), Option.getOrElse(() => aliases.ui))), Option.map((target) => `${prefixed(directory)(target)}${EVERYTHING}`));
27
28
  });
28
- // src/features/build-workspace-settings/model/ignored-directories.ts
29
- const IGNORE_FILES = ":(glob)**/.gitignore";
30
- const SEPARATOR = "/";
31
- const NEGATION = "!";
32
- const CONTENTS = "/**";
33
- const ROOT = ".";
34
- const ANYWHERE = "**/";
35
- const READ_CONCURRENCY$2 = 16;
36
- const DIRECTORY_ENTRY = /^(?<anchor>\/?)(?<name>[^!#/].*)\/$/u;
37
- const scopedName = (anchor, name) => {
38
- if (anchor === SEPARATOR || String.includes(SEPARATOR)(name)) return name;
39
- return `${ANYWHERE}${name}`;
40
- };
41
- const inDirectory = (directory) => (glob) => {
42
- if (directory === ROOT) return glob;
43
- return `${directory}${SEPARATOR}${glob}`;
44
- };
45
- const globOf = (directory) => (line) => {
46
- const found = DIRECTORY_ENTRY.exec(String.trim(line));
47
- return pipe(Option.fromNullishOr(found), Option.flatMap(({ groups }) => Option.fromNullishOr(groups)), Option.flatMap(({ anchor, name }) => Option.map(Option.fromNullishOr(name), (entry) => scopedName(anchor ?? "", entry))), Option.map(inDirectory(directory)));
48
- };
49
- const keptGlob = Effect.fn("keptGlob")(function* keptGlob(root, glob) {
50
- const listed = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)${glob}/**`]);
51
- return Option.some(glob).pipe(Option.filter(() => Array.isReadonlyArrayEmpty(listed)));
52
- });
53
- const globsIn = Effect.fn("globsIn")(function* globsIn(root, file) {
54
- const files = yield* RepositoryFiles;
55
- const text = yield* files.readFile(files.join(root, file));
56
- const toGlob = globOf(files.dirname(file));
57
- return pipe(Option.getOrElse(text, () => ""), String.split("\n"), Array.map(toGlob), Array.getSomes);
58
- });
59
- const collectIgnoredDirectories = Effect.fn("collectIgnoredDirectories")(function* collectIgnoredDirectories(root) {
60
- const ignoreFiles = yield* (yield* RepositoryFiles).matchingFiles(root, [IGNORE_FILES]);
61
- const globs = yield* Effect.forEach(ignoreFiles, (file) => globsIn(root, file), { concurrency: 1 });
62
- const candidates = Array.dedupe(Array.flatten(globs));
63
- const kept = yield* Effect.forEach(candidates, (glob) => keptGlob(root, glob), { concurrency: READ_CONCURRENCY$2 });
64
- return pipe(Array.getSomes(kept), Array.flatMap((glob) => [{
65
- pattern: `${NEGATION}${glob}`,
66
- base: "workspace"
67
- }, {
68
- pattern: `${NEGATION}${glob}${CONTENTS}`,
69
- base: "workspace"
70
- }]));
71
- });
72
- const ignoredDirectories = (root) => Effect.runPromise(collectIgnoredDirectories(root).pipe(Effect.provide(nodeRepositoryFiles)));
73
- // src/features/build-workspace-settings/model/source-directories.ts
74
- const SOURCE_DIRECTORY = "src";
75
- const RUST_MANIFEST = "Cargo.toml";
76
- const READ_CONCURRENCY$1 = 16;
77
- const directoryLayoutIn = Effect.fn("directoryLayoutIn")(function* directoryLayoutIn(root, directories) {
78
- const files = yield* RepositoryFiles;
79
- const listed = yield* Effect.forEach(directories, (directory) => {
80
- const source = files.join(directory, SOURCE_DIRECTORY);
81
- return Effect.all([files.isDirectory(files.join(root, source)), files.exists(files.join(root, directory, RUST_MANIFEST))], { concurrency: "unbounded" }).pipe(Effect.map(([isDirectory, isRust]) => pipe(isDirectory, Option.filter((found) => found && !isRust), Option.as(source))));
82
- }, { concurrency: READ_CONCURRENCY$1 });
83
- return {
84
- sourceDirectories: Array.getSomes(listed),
85
- ignoredDirectories: yield* collectIgnoredDirectories(root)
86
- };
87
- });
88
29
  // src/features/build-workspace-settings/model/workspace-public-entries.ts
89
30
  const PACK_ENTRY = ["pack", "entry"];
90
31
  const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
@@ -115,6 +56,7 @@ const publicEntryFiles = Effect.fn("publicEntryFiles")(function* publicEntryFile
115
56
  const CONFIG_FILE = "vite.config.ts";
116
57
  const SHADCN_FILE = "components.json";
117
58
  const READ_CONCURRENCY = 16;
59
+ const ROOT_WORKSPACE = ".";
118
60
  const MSCH_LINT = ["msch", "lint"];
119
61
  const MSCH_DEV_DEPENDENCIES = ["msch", "devDependencies"];
120
62
  const Severity = Schema.Literals(Record.keys({
@@ -245,7 +187,8 @@ const collectWorkspaceSettings = Effect.fn("collectWorkspaceSettings")(function*
245
187
  const found = yield* Effect.forEach(directories, (directory) => workspaceIn(options, directory), { concurrency: READ_CONCURRENCY });
246
188
  const shadcnUi = yield* Effect.forEach(directories, (directory) => shadcnUiIn(options.root, files.join(directory, SHADCN_FILE)), { concurrency: READ_CONCURRENCY });
247
189
  return {
248
- ...yield* directoryLayoutIn(options.root, directories),
190
+ members: pipe(directories, Array.filter((directory) => directory !== ROOT_WORKSPACE)),
191
+ ignoredDirectories: yield* collectIgnoredDirectories(options.root),
249
192
  lint: {
250
193
  ignorePatterns: pipe(found, Array.flatMap(({ ignorePatterns }) => ignorePatterns)),
251
194
  overrides: pipe(found, Array.flatMap(({ overrides }) => overrides)),
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-settings.mjs","names":["Str","Rec","Arr","READ_CONCURRENCY","Str","Arr","READ_CONCURRENCY","Arr","Arr","MANIFEST_FILE","Rec","Arr"],"sources":["../src/features/build-workspace-settings/model/shadcn-ui.ts","../src/features/build-workspace-settings/model/ignored-directories.ts","../src/features/build-workspace-settings/model/source-directories.ts","../src/features/build-workspace-settings/model/workspace-public-entries.ts","../src/features/build-workspace-settings/model/workspace-settings.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { prefixed, withoutRelative } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst MANIFEST_FILE = \"package.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst ManifestImports = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\nconst decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));\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 const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const directory = files.dirname(name);\n const configText = yield* files.readFile(files.join(root, name));\n const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodeManifestImports),\n Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }) =>\n pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n Option.getOrElse(() => aliases.ui),\n ),\n ),\n Option.map((target) => `${prefixed(directory)(target)}${EVERYTHING}`),\n );\n});\n","import { Array as Arr, Effect, Option, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles, nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst IGNORE_FILES = \":(glob)**/.gitignore\";\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst CONTENTS = \"/**\";\nconst ROOT = \".\";\nconst ANYWHERE = \"**/\";\nconst READ_CONCURRENCY = 16;\nconst DIRECTORY_ENTRY = /^(?<anchor>\\/?)(?<name>[^!#/].*)\\/$/u;\n\nexport interface IgnoredDirectory {\n readonly pattern: string;\n readonly base: \"workspace\";\n}\n\nconst scopedName = (anchor: string, name: string): string => {\n if (anchor === SEPARATOR || Str.includes(SEPARATOR)(name)) {\n return name;\n }\n return `${ANYWHERE}${name}`;\n};\n\nconst inDirectory =\n (directory: string) =>\n (glob: string): string => {\n if (directory === ROOT) {\n return glob;\n }\n return `${directory}${SEPARATOR}${glob}`;\n };\n\nconst globOf =\n (directory: string) =>\n (line: string): Option.Option<string> => {\n const found = DIRECTORY_ENTRY.exec(Str.trim(line));\n return pipe(\n Option.fromNullishOr(found),\n Option.flatMap(({ groups }) => Option.fromNullishOr(groups)),\n Option.flatMap(({ anchor, name }) =>\n Option.map(Option.fromNullishOr(name), (entry) => scopedName(anchor ?? \"\", entry)),\n ),\n Option.map(inDirectory(directory)),\n );\n };\n\nconst keptGlob = Effect.fn(\"keptGlob\")(function* keptGlob(root: string, glob: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [`:(glob)${glob}/**`]);\n return Option.some(glob).pipe(Option.filter(() => Arr.isReadonlyArrayEmpty(listed)));\n});\n\nconst globsIn = Effect.fn(\"globsIn\")(function* globsIn(root: string, file: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n const toGlob = globOf(files.dirname(file));\n return pipe(\n Option.getOrElse(text, () => \"\"),\n Str.split(\"\\n\"),\n Arr.map(toGlob),\n Arr.getSomes,\n );\n});\n\nexport const collectIgnoredDirectories = Effect.fn(\"collectIgnoredDirectories\")(\n function* collectIgnoredDirectories(root: string) {\n const files = yield* RepositoryFiles;\n const ignoreFiles = yield* files.matchingFiles(root, [IGNORE_FILES]);\n const globs = yield* Effect.forEach(ignoreFiles, (file) => globsIn(root, file), {\n concurrency: 1,\n });\n const candidates = Arr.dedupe(Arr.flatten(globs));\n const kept = yield* Effect.forEach(candidates, (glob) => keptGlob(root, glob), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(\n Arr.getSomes(kept),\n Arr.flatMap((glob): readonly IgnoredDirectory[] => [\n { pattern: `${NEGATION}${glob}`, base: \"workspace\" },\n { pattern: `${NEGATION}${glob}${CONTENTS}`, base: \"workspace\" },\n ]),\n );\n },\n);\n\nexport const ignoredDirectories = (root: string): Promise<readonly IgnoredDirectory[]> =>\n Effect.runPromise(collectIgnoredDirectories(root).pipe(Effect.provide(nodeRepositoryFiles)));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { collectIgnoredDirectories } from \"./ignored-directories.ts\";\n\nconst SOURCE_DIRECTORY = \"src\";\nconst RUST_MANIFEST = \"Cargo.toml\";\nconst READ_CONCURRENCY = 16;\n\nexport const directoryLayoutIn = Effect.fn(\"directoryLayoutIn\")(function* directoryLayoutIn(\n root: string,\n directories: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* Effect.forEach(\n directories,\n (directory) => {\n const source = files.join(directory, SOURCE_DIRECTORY);\n return Effect.all(\n [\n files.isDirectory(files.join(root, source)),\n files.exists(files.join(root, directory, RUST_MANIFEST)),\n ],\n { concurrency: \"unbounded\" },\n ).pipe(\n Effect.map(([isDirectory, isRust]) =>\n pipe(\n isDirectory,\n Option.filter((found) => found && !isRust),\n Option.as(source),\n ),\n ),\n );\n },\n { concurrency: READ_CONCURRENCY },\n );\n return {\n sourceDirectories: Arr.getSomes(listed),\n ignoredDirectories: yield* collectIgnoredDirectories(root),\n };\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n EntryManifestJson,\n entriesOf,\n PackEntry,\n publicEntriesOf,\n} from \"#/entities/package/index.ts\";\nimport type { EntryManifest, PackEntrySource } from \"#/entities/package/index.ts\";\nimport { literalOf, nestedValues } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst PACK_ENTRY = [\"pack\", \"entry\"] as const;\n\nconst decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);\nconst decodePackEntry = Schema.decodeUnknownOption(PackEntry);\n\nconst packEntriesIn = (program: unknown): readonly PackEntrySource[] =>\n pipe(\n nestedValues(PACK_ENTRY)(program),\n Arr.flatMap((node) =>\n pipe(\n literalOf(node),\n Option.flatMap(decodePackEntry),\n Option.toArray,\n Arr.flatMap(entriesOf),\n ),\n ),\n );\n\ninterface EntryFilesRequest {\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst entryFilesOf =\n ({ join, packEntries }: EntryFilesRequest) =>\n (manifest: EntryManifest): readonly string[] => {\n const joined = pipe(\n packEntries,\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n );\n return pipe(\n publicEntriesOf({ manifest, join, packEntries: joined }),\n Arr.map(({ source }) => source),\n Arr.dedupe,\n );\n };\n\nexport const publicEntryFiles = Effect.fn(\"publicEntryFiles\")(function* publicEntryFiles(\n root: string,\n directory: string,\n config: Option.Option<unknown>,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const packEntries = pipe(\n config,\n Option.map(packEntriesIn),\n Option.getOrElse(() => []),\n );\n const join = (target: string): string => files.join(directory, target);\n return pipe(\n text,\n Option.flatMap(decodeEntryManifest),\n Option.map(entryFilesOf({ join, packEntries })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport type { AllowWarnDeny, OxlintOverride } from \"vite-plus/lint\";\n\nimport { readManifest } from \"#/entities/package/index.ts\";\nimport {\n deployEntries,\n literalSettings,\n merged,\n programOf,\n settingsInvalid,\n usedFrom,\n workspaceDirectories,\n prefixed,\n NO_TASKS,\n TEST_TASK,\n definesTask,\n tasksOf,\n} from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSource, WorkspaceTasks } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles, nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport type { IgnoredDirectory } from \"./ignored-directories.ts\";\nimport { shadcnUiIn } from \"./shadcn-ui.ts\";\nimport { directoryLayoutIn } from \"./source-directories.ts\";\nimport { publicEntryFiles } from \"./workspace-public-entries.ts\";\n\nexport type RuleSet = Readonly<Record<string, unknown>>;\nexport type RuleSets = Readonly<Record<string, RuleSet>>;\nexport type DependencySets = Readonly<Record<string, readonly string[]>>;\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SHADCN_FILE = \"components.json\";\nconst READ_CONCURRENCY = 16;\nconst MSCH_LINT = [\"msch\", \"lint\"] as const;\nconst MSCH_DEV_DEPENDENCIES = [\"msch\", \"devDependencies\"] as const;\n\ntype SeverityName = Extract<AllowWarnDeny, string>;\n\nconst SEVERITY_NAMES: Readonly<Record<SeverityName, true>> = {\n off: true,\n allow: true,\n warn: true,\n error: true,\n deny: true,\n};\nconst Severity = Schema.Literals<readonly SeverityName[]>(Rec.keys(SEVERITY_NAMES));\nconst SeverityWithOptions = Schema.mutable(\n Schema.TupleWithRest(Schema.Tuple([Severity]), [Schema.Unknown]),\n);\nconst RuleSetting = Schema.Union([Severity, SeverityWithOptions]);\nconst Rules = Schema.Record(Schema.String, RuleSetting);\nconst decodeRules = Schema.decodeUnknownEffect(Rules);\nconst Names = Schema.optional(Schema.Array(Schema.String));\nconst WorkspaceOverride = Schema.Struct({\n files: Schema.Array(Schema.String),\n excludeFiles: Names,\n rules: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n use: Names,\n});\nconst WorkspaceLintSettings = Schema.Struct({\n ignorePatterns: Names,\n overrides: Schema.optional(Schema.Array(WorkspaceOverride)),\n});\nconst DevDependencySettings = Schema.Struct({ use: Names, dependencies: Names });\nconst WorkspaceDevDependencies = Schema.Record(Schema.String, DevDependencySettings);\n\nexport interface DevDependencyAllowance {\n readonly workspaces: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nexport interface WorkspaceLint {\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly shadcnUi: readonly string[];\n readonly publicEntries: readonly string[];\n readonly deployEntries: readonly string[];\n}\n\nexport interface WorkspaceSettings {\n readonly lint: WorkspaceLint;\n readonly sourceDirectories: readonly string[];\n readonly ignoredDirectories: readonly IgnoredDirectory[];\n readonly testProjects: readonly string[];\n readonly tasks: WorkspaceTasks;\n readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;\n}\n\nexport interface SettingsOptions {\n readonly root: string;\n readonly ruleSets: RuleSets;\n readonly dependencySets: DependencySets;\n}\n\ninterface Workspace {\n readonly directory: string;\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;\n readonly ownTests: boolean;\n readonly tasks: WorkspaceTasks;\n readonly publicEntries: readonly string[];\n}\n\nconst overrideOf = Effect.fn(\"overrideOf\")(function* overrideOf(\n source: WorkspaceSource,\n ruleSets: RuleSets,\n override: typeof WorkspaceOverride.Type,\n) {\n const { file, directory } = source;\n const fromSets = yield* usedFrom(file, ruleSets, override.use ?? []);\n const rules = yield* decodeRules(merged([...fromSets, override.rules ?? {}])).pipe(\n Effect.mapError((error) => settingsInvalid(file)(error.message)),\n );\n const files = pipe(override.files, Arr.map(prefixed(directory)));\n return pipe(\n Option.fromUndefinedOr(override.excludeFiles),\n Option.match({\n onNone: (): OxlintOverride => ({ files, rules }),\n onSome: (excluded): OxlintOverride => ({\n files,\n excludeFiles: pipe(excluded, Arr.map(prefixed(directory))),\n rules,\n }),\n }),\n );\n});\n\nconst lintOf = Effect.fn(\"lintOf\")(function* lintOf(source: WorkspaceSource, ruleSets: RuleSets) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_LINT,\n decode: Schema.decodeUnknownEffect(WorkspaceLintSettings),\n });\n const lint = Option.getOrElse(settings, (): typeof WorkspaceLintSettings.Type => ({}));\n const overrides = yield* Effect.forEach(\n lint.overrides ?? [],\n (override) => overrideOf(source, ruleSets, override),\n { concurrency: 1 },\n );\n const ignorePatterns = pipe(lint.ignorePatterns ?? [], Arr.map(prefixed(source.directory)));\n return { ignorePatterns, overrides };\n});\n\nconst allowanceOf = Effect.fn(\"allowanceOf\")(function* allowanceOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n [reason, allowance]: readonly [string, typeof DevDependencySettings.Type],\n) {\n const sets = yield* usedFrom(source.file, dependencySets, allowance.use ?? []);\n const dependencies = [...Arr.flatten(sets), ...(allowance.dependencies ?? [])];\n return [\n `${source.directory}: ${reason}`,\n { workspaces: [source.directory], dependencies },\n ] as const;\n});\n\nconst devDependenciesOf = Effect.fn(\"devDependenciesOf\")(function* devDependenciesOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_DEV_DEPENDENCIES,\n decode: Schema.decodeUnknownEffect(WorkspaceDevDependencies),\n });\n const allowed = Rec.toEntries(Option.getOrElse(settings, () => ({})));\n const entries = yield* Effect.forEach(\n allowed,\n (entry) => allowanceOf(source, dependencySets, entry),\n {\n concurrency: 1,\n },\n );\n return Rec.fromEntries(entries);\n});\n\nconst settingsOf = Effect.fn(\"settingsOf\")(function* settingsOf(\n source: WorkspaceSource,\n options: SettingsOptions,\n) {\n const lint = yield* lintOf(source, options.ruleSets);\n const devDependencies = yield* devDependenciesOf(source, options.dependencySets);\n const ownTests = definesTask(TEST_TASK)(source.program);\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(files.dirname(source.file));\n const tasks = tasksOf(manifest)(source.program);\n return { directory: source.directory, ...lint, devDependencies, ownTests, tasks };\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(\n options: SettingsOptions,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(options.root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.none());\n return {\n directory,\n ignorePatterns: [],\n overrides: [],\n devDependencies: {},\n ownTests: false,\n tasks: NO_TASKS,\n publicEntries,\n };\n }\n const program = yield* programOf(file, text.value);\n const settings = yield* settingsOf({ file, directory, program }, options);\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.some(program));\n return { ...settings, publicEntries };\n});\n\nconst mergedTasks = (found: readonly { readonly tasks: WorkspaceTasks }[]): WorkspaceTasks => ({\n verify: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.verify),\n ),\n native: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.native),\n ),\n});\n\nconst collectWorkspaceSettings = Effect.fn(\"collectWorkspaceSettings\")(\n function* collectWorkspaceSettings(options: SettingsOptions) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(options.root);\n const found: readonly Workspace[] = yield* Effect.forEach(\n directories,\n (directory) => workspaceIn(options, directory),\n { concurrency: READ_CONCURRENCY },\n );\n const shadcnUi = yield* Effect.forEach(\n directories,\n (directory) => shadcnUiIn(options.root, files.join(directory, SHADCN_FILE)),\n { concurrency: READ_CONCURRENCY },\n );\n return {\n ...(yield* directoryLayoutIn(options.root, directories)),\n lint: {\n ignorePatterns: pipe(\n found,\n Arr.flatMap(({ ignorePatterns }) => ignorePatterns),\n ),\n overrides: pipe(\n found,\n Arr.flatMap(({ overrides }) => overrides),\n ),\n shadcnUi: Arr.getSomes(shadcnUi),\n publicEntries: pipe(\n found,\n Arr.flatMap(({ publicEntries }) => publicEntries),\n ),\n deployEntries: yield* deployEntries(options.root),\n },\n testProjects: pipe(\n found,\n Arr.filter(({ ownTests }) => !ownTests),\n Arr.map(({ directory }) => directory),\n ),\n tasks: mergedTasks(found),\n devDependencies: merged(\n pipe(\n found,\n Arr.map(({ devDependencies }) => devDependencies),\n ),\n ),\n };\n },\n);\n\nexport const workspaceSettings = (options: SettingsOptions): Promise<WorkspaceSettings> =>\n Effect.runPromise(collectWorkspaceSettings(options).pipe(Effect.provide(nodeRepositoryFiles)));\n\nexport type { WorkspaceTasks } from \"#/entities/workspace/index.ts\";\n"],"mappings":";;;;AAKA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,aAAa;AAEnB,MAAM,eAAe,OAAO,OAAO,EAAE,SAAS,OAAO,OAAO,EAAE,IAAI,OAAO,OAAO,CAAC,EAAE,CAAC;AACpF,MAAM,kBAAkB,OAAO,OAAO,EACpC,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,EACtE,CAAC;AACD,MAAM,qBAAqB,OAAO,oBAAoB,OAAO,eAAe,YAAY,CAAC;AACzF,MAAM,wBAAwB,OAAO,oBAAoB,OAAO,eAAe,eAAe,CAAC;AAE/F,MAAM,kBAAkBA,OAAI,QAAQ,UAAU,EAAE;AAEhD,MAAM,gBACH,WACA,CAAC,KAAK,YAA8D;CACnE,IAAI,CAACA,OAAI,SAAS,QAAQ,CAAC,CAAC,GAAG,GAC7B,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,OAAO,aAAa,QAAQ,KAAK,CAAC;CAEpE,MAAM,SAAS,gBAAgB,GAAG;C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{"version":3,"file":"workspace-settings.mjs","names":["Str","Rec","Arr","Arr","MANIFEST_FILE","Rec","Arr"],"sources":["../src/features/build-workspace-settings/model/shadcn-ui.ts","../src/features/build-workspace-settings/model/workspace-public-entries.ts","../src/features/build-workspace-settings/model/workspace-settings.ts"],"sourcesContent":["import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { prefixed, withoutRelative } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst MANIFEST_FILE = \"package.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst ManifestImports = Schema.Struct({\n imports: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\nconst decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));\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 const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const directory = files.dirname(name);\n const configText = yield* files.readFile(files.join(root, name));\n const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodeManifestImports),\n Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }) =>\n pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n Option.getOrElse(() => aliases.ui),\n ),\n ),\n Option.map((target) => `${prefixed(directory)(target)}${EVERYTHING}`),\n );\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n EntryManifestJson,\n entriesOf,\n PackEntry,\n publicEntriesOf,\n} from \"#/entities/package/index.ts\";\nimport type { EntryManifest, PackEntrySource } from \"#/entities/package/index.ts\";\nimport { literalOf, nestedValues } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst PACK_ENTRY = [\"pack\", \"entry\"] as const;\n\nconst decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);\nconst decodePackEntry = Schema.decodeUnknownOption(PackEntry);\n\nconst packEntriesIn = (program: unknown): readonly PackEntrySource[] =>\n pipe(\n nestedValues(PACK_ENTRY)(program),\n Arr.flatMap((node) =>\n pipe(\n literalOf(node),\n Option.flatMap(decodePackEntry),\n Option.toArray,\n Arr.flatMap(entriesOf),\n ),\n ),\n );\n\ninterface EntryFilesRequest {\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nconst entryFilesOf =\n ({ join, packEntries }: EntryFilesRequest) =>\n (manifest: EntryManifest): readonly string[] => {\n const joined = pipe(\n packEntries,\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n );\n return pipe(\n publicEntriesOf({ manifest, join, packEntries: joined }),\n Arr.map(({ source }) => source),\n Arr.dedupe,\n );\n };\n\nexport const publicEntryFiles = Effect.fn(\"publicEntryFiles\")(function* publicEntryFiles(\n root: string,\n directory: string,\n config: Option.Option<unknown>,\n) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));\n const packEntries = pipe(\n config,\n Option.map(packEntriesIn),\n Option.getOrElse(() => []),\n );\n const join = (target: string): string => files.join(directory, target);\n return pipe(\n text,\n Option.flatMap(decodeEntryManifest),\n Option.map(entryFilesOf({ join, packEntries })),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport type { AllowWarnDeny, OxlintOverride } from \"vite-plus/lint\";\n\nimport { readManifest } from \"#/entities/package/index.ts\";\nimport {\n deployEntries,\n literalSettings,\n merged,\n programOf,\n settingsInvalid,\n usedFrom,\n workspaceDirectories,\n prefixed,\n NO_TASKS,\n TEST_TASK,\n definesTask,\n tasksOf,\n} from \"#/entities/workspace/index.ts\";\nimport type { WorkspaceSource, WorkspaceTasks } from \"#/entities/workspace/index.ts\";\nimport { collectIgnoredDirectories } from \"#/shared/lib/ignored-directories.ts\";\nimport type { IgnoredDirectory } from \"#/shared/lib/ignored-directories.ts\";\nimport { RepositoryFiles, nodeRepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { shadcnUiIn } from \"./shadcn-ui.ts\";\nimport { publicEntryFiles } from \"./workspace-public-entries.ts\";\n\nexport type RuleSet = Readonly<Record<string, unknown>>;\nexport type RuleSets = Readonly<Record<string, RuleSet>>;\nexport type DependencySets = Readonly<Record<string, readonly string[]>>;\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SHADCN_FILE = \"components.json\";\nconst READ_CONCURRENCY = 16;\nconst ROOT_WORKSPACE = \".\";\nconst MSCH_LINT = [\"msch\", \"lint\"] as const;\nconst MSCH_DEV_DEPENDENCIES = [\"msch\", \"devDependencies\"] as const;\n\ntype SeverityName = Extract<AllowWarnDeny, string>;\n\nconst SEVERITY_NAMES: Readonly<Record<SeverityName, true>> = {\n off: true,\n allow: true,\n warn: true,\n error: true,\n deny: true,\n};\nconst Severity = Schema.Literals<readonly SeverityName[]>(Rec.keys(SEVERITY_NAMES));\nconst SeverityWithOptions = Schema.mutable(\n Schema.TupleWithRest(Schema.Tuple([Severity]), [Schema.Unknown]),\n);\nconst RuleSetting = Schema.Union([Severity, SeverityWithOptions]);\nconst Rules = Schema.Record(Schema.String, RuleSetting);\nconst decodeRules = Schema.decodeUnknownEffect(Rules);\nconst Names = Schema.optional(Schema.Array(Schema.String));\nconst WorkspaceOverride = Schema.Struct({\n files: Schema.Array(Schema.String),\n excludeFiles: Names,\n rules: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n use: Names,\n});\nconst WorkspaceLintSettings = Schema.Struct({\n ignorePatterns: Names,\n overrides: Schema.optional(Schema.Array(WorkspaceOverride)),\n});\nconst DevDependencySettings = Schema.Struct({ use: Names, dependencies: Names });\nconst WorkspaceDevDependencies = Schema.Record(Schema.String, DevDependencySettings);\n\nexport interface DevDependencyAllowance {\n readonly workspaces: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nexport interface WorkspaceLint {\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly shadcnUi: readonly string[];\n readonly publicEntries: readonly string[];\n readonly deployEntries: readonly string[];\n}\n\nexport interface WorkspaceSettings {\n readonly lint: WorkspaceLint;\n readonly members: readonly string[];\n readonly ignoredDirectories: readonly IgnoredDirectory[];\n readonly testProjects: readonly string[];\n readonly tasks: WorkspaceTasks;\n readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;\n}\n\nexport interface SettingsOptions {\n readonly root: string;\n readonly ruleSets: RuleSets;\n readonly dependencySets: DependencySets;\n}\n\ninterface Workspace {\n readonly directory: string;\n readonly ignorePatterns: readonly string[];\n readonly overrides: readonly OxlintOverride[];\n readonly devDependencies: Readonly<Record<string, DevDependencyAllowance>>;\n readonly ownTests: boolean;\n readonly tasks: WorkspaceTasks;\n readonly publicEntries: readonly string[];\n}\n\nconst overrideOf = Effect.fn(\"overrideOf\")(function* overrideOf(\n source: WorkspaceSource,\n ruleSets: RuleSets,\n override: typeof WorkspaceOverride.Type,\n) {\n const { file, directory } = source;\n const fromSets = yield* usedFrom(file, ruleSets, override.use ?? []);\n const rules = yield* decodeRules(merged([...fromSets, override.rules ?? {}])).pipe(\n Effect.mapError((error) => settingsInvalid(file)(error.message)),\n );\n const files = pipe(override.files, Arr.map(prefixed(directory)));\n return pipe(\n Option.fromUndefinedOr(override.excludeFiles),\n Option.match({\n onNone: (): OxlintOverride => ({ files, rules }),\n onSome: (excluded): OxlintOverride => ({\n files,\n excludeFiles: pipe(excluded, Arr.map(prefixed(directory))),\n rules,\n }),\n }),\n );\n});\n\nconst lintOf = Effect.fn(\"lintOf\")(function* lintOf(source: WorkspaceSource, ruleSets: RuleSets) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_LINT,\n decode: Schema.decodeUnknownEffect(WorkspaceLintSettings),\n });\n const lint = Option.getOrElse(settings, (): typeof WorkspaceLintSettings.Type => ({}));\n const overrides = yield* Effect.forEach(\n lint.overrides ?? [],\n (override) => overrideOf(source, ruleSets, override),\n { concurrency: 1 },\n );\n const ignorePatterns = pipe(lint.ignorePatterns ?? [], Arr.map(prefixed(source.directory)));\n return { ignorePatterns, overrides };\n});\n\nconst allowanceOf = Effect.fn(\"allowanceOf\")(function* allowanceOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n [reason, allowance]: readonly [string, typeof DevDependencySettings.Type],\n) {\n const sets = yield* usedFrom(source.file, dependencySets, allowance.use ?? []);\n const dependencies = [...Arr.flatten(sets), ...(allowance.dependencies ?? [])];\n return [\n `${source.directory}: ${reason}`,\n { workspaces: [source.directory], dependencies },\n ] as const;\n});\n\nconst devDependenciesOf = Effect.fn(\"devDependenciesOf\")(function* devDependenciesOf(\n source: WorkspaceSource,\n dependencySets: DependencySets,\n) {\n const settings = yield* literalSettings({\n source,\n path: MSCH_DEV_DEPENDENCIES,\n decode: Schema.decodeUnknownEffect(WorkspaceDevDependencies),\n });\n const allowed = Rec.toEntries(Option.getOrElse(settings, () => ({})));\n const entries = yield* Effect.forEach(\n allowed,\n (entry) => allowanceOf(source, dependencySets, entry),\n {\n concurrency: 1,\n },\n );\n return Rec.fromEntries(entries);\n});\n\nconst settingsOf = Effect.fn(\"settingsOf\")(function* settingsOf(\n source: WorkspaceSource,\n options: SettingsOptions,\n) {\n const lint = yield* lintOf(source, options.ruleSets);\n const devDependencies = yield* devDependenciesOf(source, options.dependencySets);\n const ownTests = definesTask(TEST_TASK)(source.program);\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(files.dirname(source.file));\n const tasks = tasksOf(manifest)(source.program);\n return { directory: source.directory, ...lint, devDependencies, ownTests, tasks };\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(\n options: SettingsOptions,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(options.root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.none());\n return {\n directory,\n ignorePatterns: [],\n overrides: [],\n devDependencies: {},\n ownTests: false,\n tasks: NO_TASKS,\n publicEntries,\n };\n }\n const program = yield* programOf(file, text.value);\n const settings = yield* settingsOf({ file, directory, program }, options);\n const publicEntries = yield* publicEntryFiles(options.root, directory, Option.some(program));\n return { ...settings, publicEntries };\n});\n\nconst mergedTasks = (found: readonly { readonly tasks: WorkspaceTasks }[]): WorkspaceTasks => ({\n verify: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.verify),\n ),\n native: pipe(\n found,\n Arr.flatMap(({ tasks }) => tasks.native),\n ),\n});\n\nconst collectWorkspaceSettings = Effect.fn(\"collectWorkspaceSettings\")(\n function* collectWorkspaceSettings(options: SettingsOptions) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceDirectories(options.root);\n const found: readonly Workspace[] = yield* Effect.forEach(\n directories,\n (directory) => workspaceIn(options, directory),\n { concurrency: READ_CONCURRENCY },\n );\n const shadcnUi = yield* Effect.forEach(\n directories,\n (directory) => shadcnUiIn(options.root, files.join(directory, SHADCN_FILE)),\n { concurrency: READ_CONCURRENCY },\n );\n return {\n members: pipe(\n directories,\n Arr.filter((directory) => directory !== ROOT_WORKSPACE),\n ),\n ignoredDirectories: yield* collectIgnoredDirectories(options.root),\n lint: {\n ignorePatterns: pipe(\n found,\n Arr.flatMap(({ ignorePatterns }) => ignorePatterns),\n ),\n overrides: pipe(\n found,\n Arr.flatMap(({ overrides }) => overrides),\n ),\n shadcnUi: Arr.getSomes(shadcnUi),\n publicEntries: pipe(\n found,\n Arr.flatMap(({ publicEntries }) => publicEntries),\n ),\n deployEntries: yield* deployEntries(options.root),\n },\n testProjects: pipe(\n found,\n Arr.filter(({ ownTests }) => !ownTests),\n Arr.map(({ directory }) => directory),\n ),\n tasks: mergedTasks(found),\n devDependencies: merged(\n pipe(\n found,\n Arr.map(({ devDependencies }) => devDependencies),\n ),\n ),\n };\n },\n);\n\nexport const workspaceSettings = (options: SettingsOptions): Promise<WorkspaceSettings> =>\n Effect.runPromise(collectWorkspaceSettings(options).pipe(Effect.provide(nodeRepositoryFiles)));\n\nexport type { WorkspaceTasks } from \"#/entities/workspace/index.ts\";\n"],"mappings":";;;;;AAKA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,aAAa;AAEnB,MAAM,eAAe,OAAO,OAAO,EAAE,SAAS,OAAO,OAAO,EAAE,IAAI,OAAO,OAAO,CAAC,EAAE,CAAC;AACpF,MAAM,kBAAkB,OAAO,OAAO,EACpC,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,EACtE,CAAC;AACD,MAAM,qBAAqB,OAAO,oBAAoB,OAAO,eAAe,YAAY,CAAC;AACzF,MAAM,wBAAwB,OAAO,oBAAoB,OAAO,eAAe,eAAe,CAAC;AAE/F,MAAM,kBAAkBA,OAAI,QAAQ,UAAU,EAAE;AAEhD,MAAM,gBACH,WACA,CAAC,KAAK,YAA8D;CACnE,IAAI,CAACA,OAAI,SA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+1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/msch",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "masseater's check policy: points every finite value set and object shape at its one owner, and ships the oxlint preset of plugins and rules.",
5
5
  "keywords": [
6
6
  "lint",
@@ -19,11 +19,13 @@
19
19
  "directory": "libs/msch"
20
20
  },
21
21
  "bin": {
22
- "msch": "./dist/cli.mjs"
22
+ "msch": "./dist/cli.mjs",
23
+ "msch-publish": "./dist/publish.mjs"
23
24
  },
24
25
  "files": [
25
26
  "dist",
26
27
  "skills/msch-checks",
28
+ "skills/publishing",
27
29
  "skills/repository-config",
28
30
  "skills/workspace-settings",
29
31
  "src/app/vite.d.ts"
@@ -34,6 +36,10 @@
34
36
  },
35
37
  "exports": {
36
38
  "./cli": "./dist/cli.mjs",
39
+ "./cargo-inputs": {
40
+ "types": "./dist/cargo-inputs.d.mts",
41
+ "default": "./dist/cargo-inputs.mjs"
42
+ },
37
43
  "./config": {
38
44
  "types": "./dist/config.d.mts",
39
45
  "default": "./dist/config.mjs"
@@ -77,11 +83,14 @@
77
83
  "@pnpm/workspace.projects-reader": "1101.1.7",
78
84
  "@pnpm/workspace.workspace-manifest-reader": "1100.3.2",
79
85
  "@pnpm/workspace.workspace-manifest-writer": "1100.2.11",
86
+ "@r_masseater/fu4": "0.1.0",
80
87
  "@r_masseater/oxlint-plugin-decision": "0.8.0",
81
88
  "@r_masseater/oxlint-typed-rules": "0.4.1",
82
- "@r_masseater/textlint-rule-preset-ja": "0.1.1",
89
+ "@r_masseater/textlint-rule-preset-ja": "0.2.0",
83
90
  "@r_masseater/vite-plus-adopt": "0.10.2",
91
+ "@r_masseater/wism": "0.1.0",
84
92
  "@r_masseater/y8": "0.1.0",
93
+ "@r_masseater/y8-docs": "0.1.0",
85
94
  "@shadcn/lint": "0.2.5",
86
95
  "@tanstack/intent": "0.5.6",
87
96
  "@textlint-ja/textlint-rule-preset-ai-writing": "1.7.0",
@@ -92,7 +101,7 @@
92
101
  "eslint-plugin-no-comments": "1.2.1",
93
102
  "eslint-plugin-react-hooks": "7.1.1",
94
103
  "htmlparser2": "^12.0.0",
95
- "oxlint-plugin-eslint": "1.93.0",
104
+ "oxlint-plugin-eslint": "1.94.0",
96
105
  "semver": "7.8.6",
97
106
  "sql-parser-cst": "0.44.1",
98
107
  "textlint-rule-preset-ja-technical-writing": "12.0.2",
@@ -101,15 +110,16 @@
101
110
  },
102
111
  "devDependencies": {
103
112
  "@effect/platform-node": "4.1.4",
104
- "@effect/tsgo": "0.69.0",
113
+ "@effect/tsgo": "0.70.0",
105
114
  "@effect/vitest": "4.1.4",
115
+ "@masseater.dev/github-workflow": "0.0.0",
106
116
  "@r_masseater/vitest-otlp": "0.2.0",
107
117
  "@types/node": "26.6.6",
108
118
  "@types/semver": "7.8.0",
109
119
  "effect": "4.1.4",
110
120
  "typescript": "7.1.0-beta",
111
- "vite": "npm:@voidzero-dev/vite-plus-core@1.6.0",
112
- "vite-plus": "1.6.0",
121
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
122
+ "vite-plus": "1.7.0",
113
123
  "wordnet-db": "3.1.14"
114
124
  },
115
125
  "peerDependencies": {
@@ -41,8 +41,3 @@ The lint preset `@r_masseater/msch/lint` reports the rest through `vp lint`, inc
41
41
  Each finding names the file, the rule and the fix. Apply the fix the message gives.
42
42
 
43
43
  Never silence a finding with an ignore list, a disable directive or an override. When a finding is wrong, fix the check in msch.
44
-
45
- ## Related skills
46
-
47
- [repository-config](../repository-config/SKILL.md) builds the root `vite.config.ts` that configures these checks.
48
- [workspace-settings](../workspace-settings/SKILL.md) covers what one workspace may change.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: publishing
3
+ description: >
4
+ Use in a repository that depends on @r_masseater/msch when releasing a workspace: publishing an
5
+ npm package, shipping an app's installers as a GitHub Release, bumping a version, or adding a
6
+ release build to a workspace. msch-publish is the one release path for both.
7
+ metadata:
8
+ type: core
9
+ library: "@r_masseater/msch"
10
+ library_version: 0.42.0
11
+ sources:
12
+ - bin/msch-publish.ts
13
+ - src/features/publish-workspace/**
14
+ ---
15
+
16
+ # publishing
17
+
18
+ Every release is manual. Nothing publishes on a push to main, and msch reports release-please and any workflow that runs `msch-publish` from another trigger.
19
+
20
+ ## Release a workspace
21
+
22
+ 1. Bump `version` in the workspace's `package.json` in a PR. When the workspace has a `Cargo.toml` or `src-tauri/Cargo.toml`, bump its version too; msch reports a mismatch.
23
+ 2. Merge the PR.
24
+ 3. Dispatch the `publish` workflow on main with the workspace directory, such as `libs/y8` or `apps/yakusu`.
25
+
26
+ A version that is already on npm or already has a GitHub Release with assets is skipped, so dispatching twice is safe.
27
+
28
+ ## What the workspace declares
29
+
30
+ `msch-publish plan <directory>` reads the workspace and decides what to publish.
31
+
32
+ | Declaration | Result |
33
+ | --------------------------------------------------------- | --------------------------------------------------------------------- |
34
+ | `package.json` without `private: true` | Builds, tests and publishes to npm with Trusted Publishing |
35
+ | `native.binary` and `native.targets` | Builds each target on its OS and publishes one npm package per target |
36
+ | `release:linux`, `release:windows`, `release:macos` tasks | Builds on that OS; the task leaves its files in `release-assets/` |
37
+ | `release:check:<os>` tasks | Checks the built files on that OS before anything is published |
38
+ | `release:publish` task | Runs after the GitHub Release exists, with the tag in `RELEASE_TAG` |
39
+
40
+ The tag is the package name without its scope, then `-v` and the version. Release builds run in the GitHub environment `<name>-release`, which holds signing keys. A workspace at version `0.0.0` only builds; it publishes nothing.
41
+
42
+ ## The workflow
43
+
44
+ The `publish` workflow runs `msch-publish plan`, the builds and checks the plan lists, `msch-publish npm` in the `npm` environment, and `msch-publish release`, which tags the commit and uploads `release-assets/`. Runs are serialized and never cancelled.
@@ -51,9 +51,10 @@ The root `vite.config.ts` builds the whole configuration with `repositoryConfig`
51
51
  ## What repositoryConfig returns
52
52
 
53
53
  It returns `lint`, `fmt`, `staged`, `test` and `run`.
54
- It also returns the vite-plus-adopt sections `commitlint`, `dependencyRules`, `betterleaks`, `steiger` and `textlint`.
54
+ It also returns the vite-plus-adopt sections `commitlint`, `dependencyRules`, `betterleaks` and `textlint`.
55
+ The `wism` section declares the layout of workspaces, crates and skills.
55
56
 
56
- Steiger checks the `src` directory of every workspace.
57
+ wism checks the layout and imports of every member workspace, Rust crate and skill.
57
58
  The `verify` task depends on every workspace's `verify` and on every root task.
58
59
  A task added to `run.tasks` is therefore verified without listing it anywhere.
59
60
  The lint overrides already relax the rules for shadcn/ui components, public entries and deploy entries.
@@ -81,8 +82,8 @@ They also apply `decisionTestRules` to `*.test.ts`.
81
82
 
82
83
  ## Common mistakes
83
84
 
84
- | Mistake | Fix |
85
- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
86
- | Writing a workspace path in the root config | The `root-workspace-path` check rejects it. Use the workspace's `msch` block ([workspace-settings](../workspace-settings/SKILL.md)) |
87
- | Adding commitlint, textlint presets or `@ast-grep/cli` to the root `package.json` | msch already depends on them |
88
- | Running effecttsgo rules on a plain oxlint | Run `effect-tsgo patch --typescript --oxlint` in `prepare`, or lint with `effect-tsgo vp check` |
85
+ | Mistake | Fix |
86
+ | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
87
+ | Writing a workspace path in the root config | The `root-workspace-path` check rejects it. Use the workspace's `msch` block |
88
+ | Adding commitlint, textlint presets or `@ast-grep/cli` to the root `package.json` | msch already depends on them |
89
+ | Running effecttsgo rules on a plain oxlint | Run `effect-tsgo patch --typescript --oxlint` in `prepare`, or lint with `effect-tsgo vp check` |