@r_masseater/msch 0.53.0 → 0.54.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.
@@ -1 +1 @@
1
- {"version":3,"file":"publish.mjs","names":["taggedError","Arr","Str","taggedError","Rec","Arr","MANIFEST_FILE","UNVERSIONED","Str","taggedError","Rec","Str","Arr","Rec","Arr","Str","Rec","Arr","Predicate","Arr","Str","Arr","Rec","Arr","Str","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/broker.ts","../src/features/publish-workspace/model/manifest.ts","../src/features/publish-workspace/model/dependencies.ts","../src/features/publish-workspace/model/platforms.ts","../src/features/publish-workspace/model/widened-ranges.ts","../src/features/publish-workspace/model/npm.ts","../src/features/publish-workspace/model/provenance.ts","../src/features/publish-workspace/model/tags.ts","../src/features/publish-workspace/model/plan.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 { mask } from \"@masseater.dev/github-workflow\";\nimport { Config, Console, Effect, Option, Redacted, Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\n\nconst BROKER = \"https://credentials.masseater.dev/\";\nconst AUDIENCE = \"masseater-dev-credential-broker\";\n\nconst IdToken = Schema.Struct({ value: Schema.String });\nconst Issued = Schema.Record(Schema.String, Schema.Unknown);\n\n/** @internal */\nexport interface Credential {\n readonly kind: string;\n readonly field: string;\n}\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 issued = Effect.fn(\"publish.issued\")(function* issued(\n oidc: string,\n { kind, field }: Credential,\n) {\n const client = yield* HttpClient.HttpClient;\n const request = HttpClientRequest.post(`${BROKER}?only=${kind}`).pipe(\n HttpClientRequest.bearerToken(oidc),\n );\n const response = yield* HttpClient.filterStatusOk(client).execute(request);\n const body = yield* HttpClientResponse.schemaBodyJson(Issued)(response);\n const token = Option.filter(\n Option.fromNullishOr(body[field]),\n (value): value is string => typeof value === \"string\" && value !== \"\",\n );\n yield* Effect.forEach(Option.toArray(token), mask, { concurrency: 1, discard: true });\n return token;\n});\n\n/** @internal */\nexport const brokerCredential = Effect.fn(\"publish.brokerCredential\")(function* brokerCredential(\n credential: Credential,\n) {\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 Option.none<string>();\n }\n return yield* oidcToken(requestUrl.value, requestToken.value).pipe(\n Effect.flatMap((oidc) => issued(oidc, credential)),\n Effect.tapError(() => Console.log(`The credential broker gave no ${credential.field}`)),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\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\";\nconst ROOT = \".\";\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 dependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),\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 isRoot = (directory: string): boolean => directory === ROOT;\n\n/** @internal */\nexport interface Tagged extends Pick<Manifest, \"name\" | \"version\"> {\n readonly directory: string;\n}\n\n/** @internal */\nexport const tagOf = ({ directory, name, version }: Tagged): string => {\n if (isRoot(directory)) {\n return `v${version}`;\n }\n return `${releaseName({ name })}-v${version}`;\n};\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 { succeeds } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { goesToNpm, manifestIn } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\n\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst READ_CONCURRENCY = 8;\n\n/** @internal */\nexport interface Published {\n readonly directory: string;\n readonly name: string;\n readonly version: string;\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\nconst taggedError = Schema.TaggedError;\n\n/** @internal */\nexport class UnpublishedDependencies extends taggedError<\n UnpublishedDependencies,\n { readonly brand: unique symbol }\n>()(\"UnpublishedDependencies\", { message: Schema.String }) {}\n\nconst workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(manifest.dependencies),\n Option.map((dependencies) =>\n pipe(dependencies, Rec.filter(Str.startsWith(WORKSPACE_PROTOCOL)), Rec.keys),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst failWhenMissing = (\n missing: readonly Published[],\n manifest: Manifest,\n): Effect.Effect<void, UnpublishedDependencies> => {\n if (Arr.isReadonlyArrayEmpty(missing)) {\n return Effect.void;\n }\n const names = pipe(\n missing,\n Arr.map(({ directory, name, version }) => `${name}@${version} (${directory})`),\n Arr.join(\", \"),\n );\n return Effect.fail(\n UnpublishedDependencies.make({\n message: `${manifest.name} depends on versions that are not on npm yet. Publish them first: ${names}`,\n }),\n );\n};\n\n/** @internal */\nexport interface Dependent {\n readonly manifest: Manifest;\n readonly workspaces: readonly string[];\n}\n\n/** @internal */\nexport const requirePublishedDependencies = Effect.fn(\"publish.dependencies\")(\n function* requirePublishedDependencies({ manifest, workspaces }: Dependent) {\n const wanted = workspaceDependencies(manifest);\n const siblings = yield* Effect.forEach(\n workspaces,\n (directory) => manifestIn(directory).pipe(Effect.map((found) => ({ directory, ...found }))),\n { concurrency: READ_CONCURRENCY },\n );\n const internal = pipe(\n siblings,\n Arr.filter((sibling) => Arr.contains(wanted, sibling.name) && goesToNpm(sibling)),\n );\n const missing = yield* Effect.filter(\n internal,\n (sibling) => onNpm(sibling).pipe(Effect.map((published) => !published)),\n { concurrency: READ_CONCURRENCY },\n );\n yield* failWhenMissing(missing, manifest);\n },\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 { Effect, FileSystem, Path } from \"effect\";\n\nconst HOOK_FILE = \"widen-ranges.mjs\";\n\n/** @internal */\nexport const WIDEN_RANGES = `const EXACT = /^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[0-9A-Za-z.-]+)?(?:\\\\+[0-9A-Za-z.-]+)?$/u;\nconst widen = (held) =>\n held === undefined\n ? undefined\n : Object.fromEntries(Object.entries(held).map(([name, specifier]) => [name, EXACT.test(specifier) ? \\`^\\${specifier}\\` : specifier]));\nexport const hooks = {\n beforePacking: (manifest) => ({\n ...manifest,\n dependencies: widen(manifest.dependencies),\n peerDependencies: widen(manifest.peerDependencies),\n }),\n};\n`;\n\n/** @internal */\nexport const widenRangesEnv = Effect.fn(\"publish.widenRanges\")(function* widenRangesEnv(\n directory: string,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const hook = path.join(directory, HOOK_FILE);\n yield* fileSystem.writeFileString(hook, WIDEN_RANGES);\n return { pnpm_config_pnpmfile: hook };\n});\n","import { mustSucceed } from \"@masseater.dev/github-workflow\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Option,\n Path,\n Predicate,\n Record as Rec,\n Schema,\n pipe,\n} from \"effect\";\n\nimport { brokerCredential } from \"./broker.ts\";\nimport { onNpm } from \"./dependencies.ts\";\nimport { manifestIn } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { nativeFields, nativeFileOf, nativeReadme } from \"./platforms.ts\";\nimport type { NativePackage } from \"./platforms.ts\";\nimport { widenRangesEnv } from \"./widened-ranges.ts\";\n\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 authEnv = Effect.fn(\"publish.authEnv\")(function* authEnv() {\n const token = yield* brokerCredential({ kind: \"npm\", field: \"npmToken\" });\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 const env = yield* widenRangesEnv(temporary);\n yield* mustSucceed({\n command: \"vp\",\n args: [\"pm\", \"pack\", \"--out\", tarball],\n env,\n cwd: directory,\n });\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 { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { Base64 } from \"effect/encoding\";\nimport { HttpClient, HttpClientResponse } from \"effect/http\";\n\nconst ATTESTATIONS = \"https://registry.npmjs.org/-/npm/v1/attestations/\";\nconst SLSA = /slsa\\.dev\\/provenance/u;\n\nconst Digest = Schema.Struct({ gitCommit: Schema.String });\nconst Dependency = Schema.Struct({ digest: Digest });\nconst BuildDefinition = Schema.Struct({ resolvedDependencies: Schema.Array(Dependency) });\nconst Predicate = Schema.Struct({ buildDefinition: BuildDefinition });\nconst Statement = Schema.fromJsonString(Schema.Struct({ predicate: Predicate }));\n\nconst Envelope = Schema.Struct({ payload: Schema.String });\nconst Bundle = Schema.Struct({ dsseEnvelope: Envelope });\nconst Attestation = Schema.Struct({ predicateType: Schema.String, bundle: Bundle });\nconst Attestations = Schema.Struct({ attestations: Schema.Array(Attestation) });\n\n/** @internal */\nexport interface Version {\n readonly name: string;\n readonly version: string;\n}\n\nconst commitOf = (payload: string): Effect.Effect<Option.Option<string>> =>\n pipe(\n Base64.decodeString(payload),\n Effect.fromResult,\n Effect.flatMap(Schema.decodeEffect(Statement)),\n Effect.map(({ predicate }) =>\n pipe(\n Arr.head(predicate.buildDefinition.resolvedDependencies),\n Option.map(({ digest }) => digest.gitCommit),\n ),\n ),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n\n/** @internal */\nexport const provenanceCommit = Effect.fn(\"publish.provenanceCommit\")(function* provenanceCommit({\n name,\n version,\n}: Version) {\n const client = yield* HttpClient.HttpClient;\n const url = `${ATTESTATIONS}${Str.replace(\"/\", \"%2f\")(name)}@${version}`;\n const found = yield* HttpClient.filterStatusOk(client)\n .get(url)\n .pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Attestations)),\n Effect.map(({ attestations }) =>\n Arr.findFirst(attestations, ({ predicateType }) => SLSA.test(predicateType)),\n ),\n Effect.orElseSucceed(() => Option.none<(typeof Attestations.Type.attestations)[number]>()),\n );\n if (Option.isNone(found)) {\n return Option.none<string>();\n }\n return yield* commitOf(found.value.bundle.dsseEnvelope.payload);\n});\n","import { mustSucceed, outputOf, succeeds } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Config, Effect, Option, Schema, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { brokerCredential } from \"./broker.ts\";\nimport { goesToNpm, tagOf } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { provenanceCommit } from \"./provenance.ts\";\n\nconst UNVERSIONED = \"0.0.0\";\nconst LOOKUP_CONCURRENCY = 4;\n\nconst Versions = Schema.fromJsonString(Schema.Array(Schema.String));\n\n/** @internal */\nexport interface Workspace {\n readonly directory: string;\n readonly manifest: Manifest;\n}\n\n/** @internal */\nexport interface Revision {\n readonly tag: string;\n readonly sha: string;\n}\n\n/** @internal */\nexport const tagged = Effect.fn(\"publish.tagged\")(function* tagged(tag: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n return yield* succeeds({\n command: \"gh\",\n args: [\"api\", `repos/${repository}/git/ref/tags/${tag}`],\n });\n});\n\nconst tokenEnv = brokerCredential({ kind: \"github\", field: \"githubToken\" }).pipe(\n Effect.map(\n Option.match({\n onNone: (): Readonly<Record<string, string>> => ({}),\n onSome: (value): Readonly<Record<string, string>> => ({ GH_TOKEN: value }),\n }),\n ),\n);\n\n/** @internal */\nexport const createTag = Effect.fn(\"publish.createTag\")(function* createTag({\n tag,\n sha,\n}: Revision) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const env = yield* tokenEnv;\n yield* Effect.logInfo(`tagging ${tag} at ${sha}`);\n yield* mustSucceed({\n command: \"gh\",\n env,\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 isRelease = (version: string): boolean =>\n version !== UNVERSIONED && semver.valid(version) !== null && semver.prerelease(version) === null;\n\nconst publishedVersions = Effect.fn(\"publish.publishedVersions\")(function* publishedVersions({\n directory,\n manifest,\n}: Workspace) {\n if (!goesToNpm(manifest)) {\n return [];\n }\n const text = yield* outputOf({\n command: \"npm\",\n args: [\"view\", manifest.name, \"versions\", \"--json\"],\n cwd: directory,\n }).pipe(Effect.orElseSucceed(() => \"[]\"));\n const versions = yield* Schema.decodeEffect(Versions)(text).pipe(\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return pipe(\n versions,\n Arr.filter((version) => isRelease(version) && version !== manifest.version),\n );\n});\n\n/** @internal */\nexport const untaggedVersions = Effect.fn(\"publish.untaggedVersions\")(function* untaggedVersions(\n workspace: Workspace,\n) {\n const versions = yield* publishedVersions(workspace);\n return yield* Effect.filter(\n versions,\n (version) =>\n tagged(\n tagOf({ directory: workspace.directory, name: workspace.manifest.name, version }),\n ).pipe(Effect.map((found) => !found)),\n { concurrency: LOOKUP_CONCURRENCY },\n );\n});\n\nconst backfillVersion = Effect.fn(\"publish.backfillVersion\")(function* backfillVersion(\n workspace: Workspace,\n version: string,\n) {\n const { directory, manifest } = workspace;\n const tag = tagOf({ directory, name: manifest.name, version });\n const commit = yield* provenanceCommit({ name: manifest.name, version });\n if (Option.isNone(commit)) {\n yield* Effect.logWarning(`${tag} has no npm provenance, so it stays untagged`);\n return;\n }\n yield* createTag({ tag, sha: commit.value });\n});\n\n/** @internal */\nexport const backfillTags = Effect.fn(\"publish.backfillTags\")(function* backfillTags(\n workspace: Workspace,\n) {\n const versions = yield* untaggedVersions(workspace);\n yield* Effect.forEach(versions, (version) => backfillVersion(workspace, version), {\n concurrency: 1,\n discard: true,\n });\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 { onNpm, requirePublishedDependencies } from \"./dependencies.ts\";\nimport {\n environmentOf,\n goesToNpm,\n isRoot,\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\";\nimport { tagged, untaggedVersions } from \"./tags.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 tagged: Schema.Boolean,\n hook: Schema.Boolean,\n});\n\n/** @internal */\nexport type Plan = typeof PlanSchema.Type;\n\nconst AssetCount = Schema.fromJsonString(Schema.Finite);\n\nconst graphTasks = outputOf({ command: \"vp\", args: [\"run\", \"--json\"] }).pipe(\n Effect.flatMap(Schema.decodeEffect(TaskGraph)),\n Effect.map(({ tasks }) => Rec.values(tasks)),\n);\n\nconst tasksIn = (tasks: readonly (typeof Task.Type)[], directory: string): readonly string[] =>\n pipe(\n tasks,\n Arr.filter((task) => task.package === directory),\n Arr.map(({ name }) => name),\n );\n\nconst workspacesOf = (tasks: readonly (typeof Task.Type)[]): readonly string[] =>\n pipe(\n tasks,\n Arr.map((task) => task.package),\n Arr.dedupe,\n );\n\nconst allTagged = Effect.fn(\"publish.allTagged\")(function* allTagged(\n directory: string,\n manifest: Manifest,\n) {\n if (!isVersioned(manifest)) {\n return true;\n }\n const current = yield* tagged(tagOf({ directory, ...manifest }));\n const older = yield* untaggedVersions({ directory, manifest });\n return current && Arr.isReadonlyArrayEmpty(older);\n});\n\nconst workspaceOf = (directory: string): Effect.Effect<string, never, Path.Path> =>\n Path.Path.pipe(Effect.map((path) => Str.replace(TRAILING_SLASH, \"\")(path.normalize(directory))));\n\n/** @internal */\nexport const released = Effect.fn(\"publish.released\")(function* released(tag: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n return yield* succeeds({ command: \"gh\", args: [\"release\", \"view\", tag, \"--repo\", repository] });\n});\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* released(tag);\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 workspaces: readonly string[],\n) {\n if (!goesToNpm(manifest)) {\n return false;\n }\n const published = yield* onNpm({ directory, ...manifest });\n if (published) {\n return false;\n }\n yield* requirePublishedDependencies({ manifest, workspaces });\n return true;\n});\n\nconst needsRelease = Effect.fn(\"publish.needsRelease\")(function* needsRelease(\n directory: string,\n manifest: Manifest,\n builds: readonly unknown[],\n) {\n const tag = tagOf({ directory, ...manifest });\n if (!isVersioned(manifest)) {\n return false;\n }\n if (isRoot(directory)) {\n return !(yield* released(tag));\n }\n if (Arr.isReadonlyArrayEmpty(builds)) {\n return false;\n }\n return !(yield* releasedWithAssets(tag));\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 workspace = yield* workspaceOf(directory);\n const manifest = yield* manifestIn(workspace);\n const graph = yield* graphTasks;\n const tasks = tasksIn(graph, workspace);\n const npm = yield* needsNpm(workspace, manifest, workspacesOf(graph));\n const release = yield* needsRelease(workspace, manifest, buildsOf(tasks));\n const built = keepWhen(release || !isVersioned(manifest));\n const tag = tagOf({ directory: workspace, ...manifest });\n return {\n directory: workspace,\n name: releaseName(manifest),\n version: manifest.version,\n tag,\n tagged: yield* allTagged(workspace, 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 { mustSucceed, succeeds, writeOutputs } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Config, Effect, FileSystem, Option, Order, Path, pipe } from \"effect\";\n\nimport { goesToNpm, isRoot, isVersioned, manifestIn, releaseName, tagOf } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { releasedWithAssets } from \"./plan.ts\";\nimport { provenanceCommit } from \"./provenance.ts\";\nimport { backfillTags, createTag, tagged } from \"./tags.ts\";\n\nconst ASSETS = \"release-assets\";\n\nconst revisionOf = Effect.fn(\"publish.revision\")(function* revisionOf(manifest: Manifest) {\n const head = yield* Config.String(\"GITHUB_SHA\");\n if (!goesToNpm(manifest)) {\n return head;\n }\n const published = yield* provenanceCommit(manifest);\n return Option.getOrElse(published, () => head);\n});\n\nconst tagRevision = Effect.fn(\"publish.tag\")(function* tagRevision(\n tag: string,\n manifest: Manifest,\n) {\n if (yield* tagged(tag)) {\n return;\n }\n const sha = yield* revisionOf(manifest);\n yield* createTag({ tag, sha });\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 LIBRARY_NOTES = [\"--latest=false\", \"--notes\", \"\"];\nconst ROOT_NOTES = [\"--latest\", \"--generate-notes\"];\n\nconst notesOf = (directory: string): readonly string[] => {\n if (isRoot(directory)) {\n return ROOT_NOTES;\n }\n return LIBRARY_NOTES;\n};\n\ninterface Release {\n readonly directory: string;\n readonly manifest: Manifest;\n}\n\nconst createRelease = Effect.fn(\"publish.createRelease\")(function* createRelease({\n directory,\n manifest,\n}: Release) {\n const tag = tagOf({ directory, ...manifest });\n const notes = notesOf(directory);\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 \"--title\",\n `${releaseName(manifest)} v${manifest.version}`,\n ...notes,\n ],\n });\n});\n\nconst uploadAssets = Effect.fn(\"publish.uploadAssets\")(function* uploadAssets({\n directory,\n manifest,\n}: Release) {\n const tag = tagOf({ directory, ...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({ directory, manifest });\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({ directory, ...manifest });\n yield* Effect.andThen(tagRevision(tag, manifest), backfillTags({ directory, manifest }));\n yield* writeOutputs({ tag });\n if (isRoot(directory)) {\n yield* createRelease({ directory, manifest });\n }\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,CAAC;;AC1CD,MAAM,UAAU;AAEhB,MAAMA,gBAAc,OAAO;AAE3B,IAAa,gBAAb,cAAmCA,cAA8D,CAAC,CAChG,iBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAeH,MAAM,UAAU,EAAE,SAAS,WACzB,cAAc,KAAK,EAAE,SAAS,GAAG,QAAQ,GA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A,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"}
1
+ {"version":3,"file":"publish.mjs","names":["taggedError","Arr","Str","taggedError","Rec","Arr","MANIFEST_FILE","UNVERSIONED","Str","taggedError","Rec","Str","Arr","MANIFEST_FILE","taggedError","Str","Arr","Rec","Rec","Arr","Str","Rec","Arr","Predicate","Arr","Str","Arr","Rec","Arr","Str","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/broker.ts","../src/features/publish-workspace/model/manifest.ts","../src/features/publish-workspace/model/dependencies.ts","../src/features/publish-workspace/model/export-targets.ts","../src/features/publish-workspace/model/platforms.ts","../src/features/publish-workspace/model/widened-ranges.ts","../src/features/publish-workspace/model/npm.ts","../src/features/publish-workspace/model/provenance.ts","../src/features/publish-workspace/model/tags.ts","../src/features/publish-workspace/model/plan.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\n/** @internal */\nexport type GitHubFailure =\n | Config.ConfigError\n | HttpBody.HttpBodyError\n | HttpClientError.HttpClientError;\n\n/** @internal */\nexport type GitHubRequest<Success> = Effect.Effect<Success, GitHubFailure, 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 GitHubFailure | 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 }: GitHubWrite): Effect.Effect<\n Codec[\"Type\"],\n GitHubFailure | Schema.SchemaError,\n HttpClient.HttpClient | Codec[\"DecodingServices\"]\n > =>\n withBody(\"POST\", path, body).pipe(Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)));\n\nconst removeAt = (path: string): GitHubRequest<void> =>\n requestTo(\"DELETE\", path).pipe(Effect.flatMap(execute), Effect.asVoid);\n\n/** @internal */\nexport interface GitHubWrite {\n readonly path: string;\n readonly body: unknown;\n}\n\nconst postTo = ({ path, body }: GitHubWrite): GitHubRequest<void> =>\n withBody(\"POST\", path, body).pipe(Effect.asVoid);\n\nconst patchAt = ({ path, body }: GitHubWrite): GitHubRequest<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\n/** @internal */\nexport type 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\n/** @internal */\nexport type 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 { mask } from \"@masseater.dev/github-workflow\";\nimport { Config, Console, Effect, Option, Redacted, Schema } from \"effect\";\nimport { HttpClient, HttpClientRequest, HttpClientResponse } from \"effect/http\";\n\nconst BROKER = \"https://credentials.masseater.dev/\";\nconst AUDIENCE = \"masseater-dev-credential-broker\";\n\nconst IdToken = Schema.Struct({ value: Schema.String });\nconst Issued = Schema.Record(Schema.String, Schema.Unknown);\n\n/** @internal */\nexport interface Credential {\n readonly kind: string;\n readonly field: string;\n}\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 issued = Effect.fn(\"publish.issued\")(function* issued(\n oidc: string,\n { kind, field }: Credential,\n) {\n const client = yield* HttpClient.HttpClient;\n const request = HttpClientRequest.post(`${BROKER}?only=${kind}`).pipe(\n HttpClientRequest.bearerToken(oidc),\n );\n const response = yield* HttpClient.filterStatusOk(client).execute(request);\n const body = yield* HttpClientResponse.schemaBodyJson(Issued)(response);\n const token = Option.filter(\n Option.fromNullishOr(body[field]),\n (value): value is string => typeof value === \"string\" && value !== \"\",\n );\n yield* Effect.forEach(Option.toArray(token), mask, { concurrency: 1, discard: true });\n return token;\n});\n\n/** @internal */\nexport const brokerCredential = Effect.fn(\"publish.brokerCredential\")(function* brokerCredential(\n credential: Credential,\n) {\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 Option.none<string>();\n }\n return yield* oidcToken(requestUrl.value, requestToken.value).pipe(\n Effect.flatMap((oidc) => issued(oidc, credential)),\n Effect.tapError(() => Console.log(`The credential broker gave no ${credential.field}`)),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\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\";\nconst ROOT = \".\";\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 dependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),\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 isRoot = (directory: string): boolean => directory === ROOT;\n\n/** @internal */\nexport interface Tagged extends Pick<Manifest, \"name\" | \"version\"> {\n readonly directory: string;\n}\n\n/** @internal */\nexport const tagOf = ({ directory, name, version }: Tagged): string => {\n if (isRoot(directory)) {\n return `v${version}`;\n }\n return `${releaseName({ name })}-v${version}`;\n};\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 { succeeds } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { goesToNpm, manifestIn } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\n\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst READ_CONCURRENCY = 8;\n\n/** @internal */\nexport interface Published {\n readonly directory: string;\n readonly name: string;\n readonly version: string;\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\nconst taggedError = Schema.TaggedError;\n\n/** @internal */\nexport class UnpublishedDependencies extends taggedError<\n UnpublishedDependencies,\n { readonly brand: unique symbol }\n>()(\"UnpublishedDependencies\", { message: Schema.String }) {}\n\nconst workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Option.fromUndefinedOr(manifest.dependencies),\n Option.map((dependencies) =>\n pipe(dependencies, Rec.filter(Str.startsWith(WORKSPACE_PROTOCOL)), Rec.keys),\n ),\n Option.getOrElse((): readonly string[] => []),\n );\n\nconst failWhenMissing = (\n missing: readonly Published[],\n manifest: Manifest,\n): Effect.Effect<void, UnpublishedDependencies> => {\n if (Arr.isReadonlyArrayEmpty(missing)) {\n return Effect.void;\n }\n const names = pipe(\n missing,\n Arr.map(({ directory, name, version }) => `${name}@${version} (${directory})`),\n Arr.join(\", \"),\n );\n return Effect.fail(\n UnpublishedDependencies.make({\n message: `${manifest.name} depends on versions that are not on npm yet. Publish them first: ${names}`,\n }),\n );\n};\n\n/** @internal */\nexport interface Dependent {\n readonly manifest: Manifest;\n readonly workspaces: readonly string[];\n}\n\n/** @internal */\nexport const requirePublishedDependencies = Effect.fn(\"publish.dependencies\")(\n function* requirePublishedDependencies({ manifest, workspaces }: Dependent) {\n const wanted = workspaceDependencies(manifest);\n const siblings = yield* Effect.forEach(\n workspaces,\n (directory) => manifestIn(directory).pipe(Effect.map((found) => ({ directory, ...found }))),\n { concurrency: READ_CONCURRENCY },\n );\n const internal = pipe(\n siblings,\n Arr.filter((sibling) => Arr.contains(wanted, sibling.name) && goesToNpm(sibling)),\n );\n const missing = yield* Effect.filter(\n internal,\n (sibling) => onNpm(sibling).pipe(Effect.map((published) => !published)),\n { concurrency: READ_CONCURRENCY },\n );\n yield* failWhenMissing(missing, manifest);\n },\n);\n","import {\n Array as Arr,\n Effect,\n FileSystem,\n Option,\n Path,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nconst PATTERN = \"*\";\nconst MANIFEST_FILE = \"package.json\";\n\nconst taggedError = Schema.TaggedError;\n\n/** @internal */\nexport class MissingExportTargets extends taggedError<\n MissingExportTargets,\n { readonly brand: unique symbol }\n>()(\"MissingExportTargets\", { message: Schema.String }) {}\n\nconst AnyExports = Schema.optionalKey(Schema.Unknown);\nconst PublishConfig = Schema.Struct({ exports: AnyExports });\n\nconst PublishedExports = Schema.fromJsonString(\n Schema.Struct({ exports: AnyExports, publishConfig: Schema.optionalKey(PublishConfig) }),\n);\n\ntype PublishedManifest = typeof PublishedExports.Type;\n\nconst singleTarget = (target: string): readonly string[] => {\n if (Str.includes(PATTERN)(target)) {\n return [];\n }\n return [target];\n};\n\n/** @internal */\nexport const exportTargetsOf = (exports: unknown): readonly string[] => {\n if (Predicate.isString(exports)) {\n return singleTarget(exports);\n }\n if (Arr.isArray(exports)) {\n return pipe(\n exports,\n Arr.flatMap((entry) => exportTargetsOf(entry)),\n );\n }\n if (Predicate.isReadonlyObject(exports)) {\n return pipe(\n Rec.values(exports),\n Arr.flatMap((entry) => exportTargetsOf(entry)),\n );\n }\n return [];\n};\n\nconst publishedExportsOf = (manifest: PublishedManifest): unknown =>\n pipe(\n Option.fromUndefinedOr(manifest.publishConfig),\n Option.flatMap((config) => Option.fromUndefinedOr(config.exports)),\n Option.orElse(() => Option.fromUndefinedOr(manifest.exports)),\n Option.getOrUndefined,\n );\n\nconst missingMessage = (missing: readonly string[]): string =>\n `The published exports point to files the build did not write: ${Arr.join(missing, \", \")}`;\n\n/** @internal */\nexport const checkExportTargets = Effect.fn(\"publish.checkExportTargets\")(\n function* checkExportTargets(directory: string) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const manifest = yield* fileSystem\n .readFileString(path.join(directory, MANIFEST_FILE))\n .pipe(Effect.flatMap(Schema.decodeEffect(PublishedExports)));\n const missing = yield* Effect.filter(exportTargetsOf(publishedExportsOf(manifest)), (target) =>\n Effect.map(fileSystem.exists(path.join(directory, target)), (found) => !found),\n );\n return yield* pipe(\n missing,\n Arr.match({\n onEmpty: () => Effect.void,\n onNonEmpty: (list) =>\n Effect.fail(MissingExportTargets.make({ message: missingMessage(list) })),\n }),\n );\n },\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 { Effect, FileSystem, Path } from \"effect\";\n\nconst HOOK_FILE = \"widen-ranges.mjs\";\n\n/** @internal */\nexport const WIDEN_RANGES = `const EXACT = /^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[0-9A-Za-z.-]+)?(?:\\\\+[0-9A-Za-z.-]+)?$/u;\nconst widen = (held) =>\n held === undefined\n ? undefined\n : Object.fromEntries(Object.entries(held).map(([name, specifier]) => [name, EXACT.test(specifier) ? \\`^\\${specifier}\\` : specifier]));\nexport const hooks = {\n beforePacking: (manifest) => ({\n ...manifest,\n dependencies: widen(manifest.dependencies),\n peerDependencies: widen(manifest.peerDependencies),\n }),\n};\n`;\n\n/** @internal */\nexport const widenRangesEnv = Effect.fn(\"publish.widenRanges\")(function* widenRangesEnv(\n directory: string,\n) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const hook = path.join(directory, HOOK_FILE);\n yield* fileSystem.writeFileString(hook, WIDEN_RANGES);\n return { pnpm_config_pnpmfile: hook };\n});\n","import { mustSucceed } from \"@masseater.dev/github-workflow\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Option,\n Path,\n Predicate,\n Record as Rec,\n Schema,\n pipe,\n} from \"effect\";\n\nimport { brokerCredential } from \"./broker.ts\";\nimport { onNpm } from \"./dependencies.ts\";\nimport { checkExportTargets } from \"./export-targets.ts\";\nimport { manifestIn } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { nativeFields, nativeFileOf, nativeReadme } from \"./platforms.ts\";\nimport type { NativePackage } from \"./platforms.ts\";\nimport { widenRangesEnv } from \"./widened-ranges.ts\";\n\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 authEnv = Effect.fn(\"publish.authEnv\")(function* authEnv() {\n const token = yield* brokerCredential({ kind: \"npm\", field: \"npmToken\" });\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 yield* checkExportTargets(directory);\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 const env = yield* widenRangesEnv(temporary);\n yield* mustSucceed({\n command: \"vp\",\n args: [\"pm\", \"pack\", \"--out\", tarball],\n env,\n cwd: directory,\n });\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 yield* verifyPackage(directory, manifest);\n const env = yield* authEnv();\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 { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\nimport { Base64 } from \"effect/encoding\";\nimport { HttpClient, HttpClientResponse } from \"effect/http\";\n\nconst ATTESTATIONS = \"https://registry.npmjs.org/-/npm/v1/attestations/\";\nconst SLSA = /slsa\\.dev\\/provenance/u;\n\nconst Digest = Schema.Struct({ gitCommit: Schema.String });\nconst Dependency = Schema.Struct({ digest: Digest });\nconst BuildDefinition = Schema.Struct({ resolvedDependencies: Schema.Array(Dependency) });\nconst Predicate = Schema.Struct({ buildDefinition: BuildDefinition });\nconst Statement = Schema.fromJsonString(Schema.Struct({ predicate: Predicate }));\n\nconst Envelope = Schema.Struct({ payload: Schema.String });\nconst Bundle = Schema.Struct({ dsseEnvelope: Envelope });\nconst Attestation = Schema.Struct({ predicateType: Schema.String, bundle: Bundle });\nconst Attestations = Schema.Struct({ attestations: Schema.Array(Attestation) });\n\n/** @internal */\nexport interface Version {\n readonly name: string;\n readonly version: string;\n}\n\nconst commitOf = (payload: string): Effect.Effect<Option.Option<string>> =>\n pipe(\n Base64.decodeString(payload),\n Effect.fromResult,\n Effect.flatMap(Schema.decodeEffect(Statement)),\n Effect.map(({ predicate }) =>\n pipe(\n Arr.head(predicate.buildDefinition.resolvedDependencies),\n Option.map(({ digest }) => digest.gitCommit),\n ),\n ),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n\n/** @internal */\nexport const provenanceCommit = Effect.fn(\"publish.provenanceCommit\")(function* provenanceCommit({\n name,\n version,\n}: Version) {\n const client = yield* HttpClient.HttpClient;\n const url = `${ATTESTATIONS}${Str.replace(\"/\", \"%2f\")(name)}@${version}`;\n const found = yield* HttpClient.filterStatusOk(client)\n .get(url)\n .pipe(\n Effect.flatMap(HttpClientResponse.schemaBodyJson(Attestations)),\n Effect.map(({ attestations }) =>\n Arr.findFirst(attestations, ({ predicateType }) => SLSA.test(predicateType)),\n ),\n Effect.orElseSucceed(() => Option.none<(typeof Attestations.Type.attestations)[number]>()),\n );\n if (Option.isNone(found)) {\n return Option.none<string>();\n }\n return yield* commitOf(found.value.bundle.dsseEnvelope.payload);\n});\n","import { mustSucceed, outputOf, succeeds } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Config, Effect, Option, Schema, pipe } from \"effect\";\nimport semver from \"semver\";\n\nimport { brokerCredential } from \"./broker.ts\";\nimport { goesToNpm, tagOf } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { provenanceCommit } from \"./provenance.ts\";\n\nconst UNVERSIONED = \"0.0.0\";\nconst LOOKUP_CONCURRENCY = 4;\n\nconst Versions = Schema.fromJsonString(Schema.Array(Schema.String));\n\n/** @internal */\nexport interface Workspace {\n readonly directory: string;\n readonly manifest: Manifest;\n}\n\n/** @internal */\nexport interface Revision {\n readonly tag: string;\n readonly sha: string;\n}\n\n/** @internal */\nexport const tagged = Effect.fn(\"publish.tagged\")(function* tagged(tag: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n return yield* succeeds({\n command: \"gh\",\n args: [\"api\", `repos/${repository}/git/ref/tags/${tag}`],\n });\n});\n\nconst tokenEnv = brokerCredential({ kind: \"github\", field: \"githubToken\" }).pipe(\n Effect.map(\n Option.match({\n onNone: (): Readonly<Record<string, string>> => ({}),\n onSome: (value): Readonly<Record<string, string>> => ({ GH_TOKEN: value }),\n }),\n ),\n);\n\n/** @internal */\nexport const createTag = Effect.fn(\"publish.createTag\")(function* createTag({\n tag,\n sha,\n}: Revision) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n const env = yield* tokenEnv;\n yield* Effect.logInfo(`tagging ${tag} at ${sha}`);\n yield* mustSucceed({\n command: \"gh\",\n env,\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 isRelease = (version: string): boolean =>\n version !== UNVERSIONED && semver.valid(version) !== null && semver.prerelease(version) === null;\n\nconst publishedVersions = Effect.fn(\"publish.publishedVersions\")(function* publishedVersions({\n directory,\n manifest,\n}: Workspace) {\n if (!goesToNpm(manifest)) {\n return [];\n }\n const text = yield* outputOf({\n command: \"npm\",\n args: [\"view\", manifest.name, \"versions\", \"--json\"],\n cwd: directory,\n }).pipe(Effect.orElseSucceed(() => \"[]\"));\n const versions = yield* Schema.decodeEffect(Versions)(text).pipe(\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return pipe(\n versions,\n Arr.filter((version) => isRelease(version) && version !== manifest.version),\n );\n});\n\n/** @internal */\nexport const untaggedVersions = Effect.fn(\"publish.untaggedVersions\")(function* untaggedVersions(\n workspace: Workspace,\n) {\n const versions = yield* publishedVersions(workspace);\n return yield* Effect.filter(\n versions,\n (version) =>\n tagged(\n tagOf({ directory: workspace.directory, name: workspace.manifest.name, version }),\n ).pipe(Effect.map((found) => !found)),\n { concurrency: LOOKUP_CONCURRENCY },\n );\n});\n\nconst backfillVersion = Effect.fn(\"publish.backfillVersion\")(function* backfillVersion(\n workspace: Workspace,\n version: string,\n) {\n const { directory, manifest } = workspace;\n const tag = tagOf({ directory, name: manifest.name, version });\n const commit = yield* provenanceCommit({ name: manifest.name, version });\n if (Option.isNone(commit)) {\n yield* Effect.logWarning(`${tag} has no npm provenance, so it stays untagged`);\n return;\n }\n yield* createTag({ tag, sha: commit.value });\n});\n\n/** @internal */\nexport const backfillTags = Effect.fn(\"publish.backfillTags\")(function* backfillTags(\n workspace: Workspace,\n) {\n const versions = yield* untaggedVersions(workspace);\n yield* Effect.forEach(versions, (version) => backfillVersion(workspace, version), {\n concurrency: 1,\n discard: true,\n });\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 { onNpm, requirePublishedDependencies } from \"./dependencies.ts\";\nimport {\n environmentOf,\n goesToNpm,\n isRoot,\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\";\nimport { tagged, untaggedVersions } from \"./tags.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 tagged: Schema.Boolean,\n hook: Schema.Boolean,\n});\n\n/** @internal */\nexport type Plan = typeof PlanSchema.Type;\n\nconst AssetCount = Schema.fromJsonString(Schema.Finite);\n\nconst graphTasks = outputOf({ command: \"vp\", args: [\"run\", \"--json\"] }).pipe(\n Effect.flatMap(Schema.decodeEffect(TaskGraph)),\n Effect.map(({ tasks }) => Rec.values(tasks)),\n);\n\nconst tasksIn = (tasks: readonly (typeof Task.Type)[], directory: string): readonly string[] =>\n pipe(\n tasks,\n Arr.filter((task) => task.package === directory),\n Arr.map(({ name }) => name),\n );\n\nconst workspacesOf = (tasks: readonly (typeof Task.Type)[]): readonly string[] =>\n pipe(\n tasks,\n Arr.map((task) => task.package),\n Arr.dedupe,\n );\n\nconst allTagged = Effect.fn(\"publish.allTagged\")(function* allTagged(\n directory: string,\n manifest: Manifest,\n) {\n if (!isVersioned(manifest)) {\n return true;\n }\n const current = yield* tagged(tagOf({ directory, ...manifest }));\n const older = yield* untaggedVersions({ directory, manifest });\n return current && Arr.isReadonlyArrayEmpty(older);\n});\n\nconst workspaceOf = (directory: string): Effect.Effect<string, never, Path.Path> =>\n Path.Path.pipe(Effect.map((path) => Str.replace(TRAILING_SLASH, \"\")(path.normalize(directory))));\n\n/** @internal */\nexport const released = Effect.fn(\"publish.released\")(function* released(tag: string) {\n const repository = yield* Config.String(\"GITHUB_REPOSITORY\");\n return yield* succeeds({ command: \"gh\", args: [\"release\", \"view\", tag, \"--repo\", repository] });\n});\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* released(tag);\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 workspaces: readonly string[],\n) {\n if (!goesToNpm(manifest)) {\n return false;\n }\n const published = yield* onNpm({ directory, ...manifest });\n if (published) {\n return false;\n }\n yield* requirePublishedDependencies({ manifest, workspaces });\n return true;\n});\n\nconst needsRelease = Effect.fn(\"publish.needsRelease\")(function* needsRelease(\n directory: string,\n manifest: Manifest,\n builds: readonly unknown[],\n) {\n const tag = tagOf({ directory, ...manifest });\n if (!isVersioned(manifest)) {\n return false;\n }\n if (isRoot(directory)) {\n return !(yield* released(tag));\n }\n if (Arr.isReadonlyArrayEmpty(builds)) {\n return false;\n }\n return !(yield* releasedWithAssets(tag));\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 workspace = yield* workspaceOf(directory);\n const manifest = yield* manifestIn(workspace);\n const graph = yield* graphTasks;\n const tasks = tasksIn(graph, workspace);\n const npm = yield* needsNpm(workspace, manifest, workspacesOf(graph));\n const release = yield* needsRelease(workspace, manifest, buildsOf(tasks));\n const built = keepWhen(release || !isVersioned(manifest));\n const tag = tagOf({ directory: workspace, ...manifest });\n return {\n directory: workspace,\n name: releaseName(manifest),\n version: manifest.version,\n tag,\n tagged: yield* allTagged(workspace, 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 { mustSucceed, succeeds, writeOutputs } from \"@masseater.dev/github-workflow\";\nimport { Array as Arr, Config, Effect, FileSystem, Option, Order, Path, pipe } from \"effect\";\n\nimport { goesToNpm, isRoot, isVersioned, manifestIn, releaseName, tagOf } from \"./manifest.ts\";\nimport type { Manifest } from \"./manifest.ts\";\nimport { releasedWithAssets } from \"./plan.ts\";\nimport { provenanceCommit } from \"./provenance.ts\";\nimport { backfillTags, createTag, tagged } from \"./tags.ts\";\n\nconst ASSETS = \"release-assets\";\n\nconst revisionOf = Effect.fn(\"publish.revision\")(function* revisionOf(manifest: Manifest) {\n const head = yield* Config.String(\"GITHUB_SHA\");\n if (!goesToNpm(manifest)) {\n return head;\n }\n const published = yield* provenanceCommit(manifest);\n return Option.getOrElse(published, () => head);\n});\n\nconst tagRevision = Effect.fn(\"publish.tag\")(function* tagRevision(\n tag: string,\n manifest: Manifest,\n) {\n if (yield* tagged(tag)) {\n return;\n }\n const sha = yield* revisionOf(manifest);\n yield* createTag({ tag, sha });\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 LIBRARY_NOTES = [\"--latest=false\", \"--notes\", \"\"];\nconst ROOT_NOTES = [\"--latest\", \"--generate-notes\"];\n\nconst notesOf = (directory: string): readonly string[] => {\n if (isRoot(directory)) {\n return ROOT_NOTES;\n }\n return LIBRARY_NOTES;\n};\n\ninterface Release {\n readonly directory: string;\n readonly manifest: Manifest;\n}\n\nconst createRelease = Effect.fn(\"publish.createRelease\")(function* createRelease({\n directory,\n manifest,\n}: Release) {\n const tag = tagOf({ directory, ...manifest });\n const notes = notesOf(directory);\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 \"--title\",\n `${releaseName(manifest)} v${manifest.version}`,\n ...notes,\n ],\n });\n});\n\nconst uploadAssets = Effect.fn(\"publish.uploadAssets\")(function* uploadAssets({\n directory,\n manifest,\n}: Release) {\n const tag = tagOf({ directory, ...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({ directory, manifest });\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({ directory, ...manifest });\n yield* Effect.andThen(tagRevision(tag, manifest), backfillTags({ directory, manifest }));\n yield* writeOutputs({ tag });\n if (isRoot(directory)) {\n yield* createRelease({ directory, manifest });\n }\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;AAWA,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,GA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AAC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/msch",
3
- "version": "0.53.0",
3
+ "version": "0.54.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",
@@ -82,29 +82,29 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@commitlint/config-conventional": "^21.2.4",
85
- "@effect/platform-node-shared": "^4.1.4",
85
+ "@effect/platform-node-shared": "^4.1.5",
86
86
  "@html-eslint/eslint-plugin-react": "^0.68.0",
87
- "@pnpm/deps.path": "^1101.0.9",
88
- "@pnpm/lockfile.fs": "^1100.2.18",
87
+ "@pnpm/deps.path": "^1101.0.11",
88
+ "@pnpm/lockfile.fs": "^1100.2.20",
89
89
  "@pnpm/logger": "^1100.0.0",
90
- "@pnpm/workspace.projects-reader": "^1101.1.7",
91
- "@pnpm/workspace.workspace-manifest-reader": "^1100.3.2",
92
- "@pnpm/workspace.workspace-manifest-writer": "^1100.2.11",
93
- "@r_masseater/fu4": "^0.1.0",
94
- "@r_masseater/fu4-presets": "^0.1.0",
95
- "@r_masseater/h56m": "^0.1.0",
96
- "@r_masseater/h56m-presets": "^0.1.0",
90
+ "@pnpm/workspace.projects-reader": "^1101.1.9",
91
+ "@pnpm/workspace.workspace-manifest-reader": "^1100.3.4",
92
+ "@pnpm/workspace.workspace-manifest-writer": "^1100.2.13",
93
+ "@r_masseater/fu4": "^0.2.0",
94
+ "@r_masseater/fu4-presets": "^0.1.1",
95
+ "@r_masseater/h56m": "^0.2.0",
96
+ "@r_masseater/h56m-presets": "^0.2.0",
97
97
  "@r_masseater/oxlint-plugin-decision": "^0.8.0",
98
- "@r_masseater/oxlint-typed-rules": "^0.4.1",
98
+ "@r_masseater/oxlint-typed-rules": "^0.4.3",
99
99
  "@r_masseater/textlint-rule-preset-ja": "^0.2.0",
100
- "@r_masseater/vite-plus-adopt": "^0.10.2",
101
- "@r_masseater/wism": "^0.2.0",
102
- "@r_masseater/wism-presets": "^0.1.0",
103
- "@r_masseater/y8": "^0.2.0",
104
- "@r_masseater/y8-presets": "^0.2.0",
100
+ "@r_masseater/vite-plus-adopt": "^0.12.0",
101
+ "@r_masseater/wism": "^0.3.0",
102
+ "@r_masseater/wism-presets": "^0.2.0",
103
+ "@r_masseater/y8": "^0.3.0",
104
+ "@r_masseater/y8-presets": "^0.3.0",
105
105
  "@shadcn/lint": "^0.2.5",
106
106
  "@tanstack/intent": "^0.5.6",
107
- "@textlint-ja/textlint-rule-preset-ai-writing": "^1.7.0",
107
+ "@textlint-ja/textlint-rule-preset-ai-writing": "^1.7.2",
108
108
  "@vscode/tree-sitter-wasm": "^0.3.1",
109
109
  "dockerfile-ast": "^0.7.1",
110
110
  "domhandler": "^6.0.1",
@@ -112,23 +112,23 @@
112
112
  "eslint-plugin-no-comments": "^1.2.1",
113
113
  "eslint-plugin-react-hooks": "^7.1.1",
114
114
  "htmlparser2": "^12.0.0",
115
- "modern-web-guidance": "^1.0.1",
116
- "oxlint-plugin-eslint": "^1.94.0",
115
+ "modern-web-guidance": "^1.0.2",
116
+ "oxlint-plugin-eslint": "^1.95.0",
117
117
  "semver": "^7.8.6",
118
- "sql-parser-cst": "^0.44.1",
119
- "textlint-rule-preset-ja-technical-writing": "^12.0.2",
118
+ "sql-parser-cst": "^0.45.0",
119
+ "textlint-rule-preset-ja-technical-writing": "^12.1.0",
120
120
  "toml-eslint-parser": "^1.0.3",
121
121
  "yaml": "^2.9.1"
122
122
  },
123
123
  "devDependencies": {
124
- "@effect/platform-node": "4.1.4",
125
- "@effect/tsgo": "0.70.0",
126
- "@effect/vitest": "4.1.4",
124
+ "@effect/platform-node": "4.1.5",
125
+ "@effect/tsgo": "0.73.2",
126
+ "@effect/vitest": "4.1.5",
127
127
  "@masseater.dev/github-workflow": "0.0.0",
128
- "@r_masseater/vitest-otlp": "0.2.0",
128
+ "@r_masseater/vitest-otlp": "0.2.2",
129
129
  "@types/node": "26.6.6",
130
130
  "@types/semver": "7.8.0",
131
- "effect": "4.1.4",
131
+ "effect": "4.1.5",
132
132
  "oxlint": "1.94.0",
133
133
  "typescript": "7.1.0-beta",
134
134
  "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
@@ -23,6 +23,8 @@ Every release is manual. Nothing publishes on a push to main, and msch reports r
23
23
  2. Merge the PR.
24
24
  3. Dispatch the `publish` workflow on main with the workspace directory, such as `libs/y8` or `apps/yakusu`.
25
25
 
26
+ An AI agent dispatches the `publish` workflow itself once the version bump is on main, without asking the owner first. The owner's repositories are set up so that a release an agent starts on its own does no harm.
27
+
26
28
  A version that is already on npm or already has a GitHub Release with assets is skipped, so dispatching twice is safe. A version that is published but has no tag, including an older version, gets its tag on the next dispatch, on the commit its npm provenance names. The tag is created with a GitHub token from the credential broker when the broker grants one, because the workflow token cannot tag a commit that changes `.github/workflows`. A package whose `workspace:` dependencies are not on npm at their current versions is refused; publish those first.
27
29
 
28
30
  In the repository every dependency is an exact version, as the `version-range` check requires. When packing, msch-publish widens each exact version in `dependencies` and `peerDependencies` to a `^` range, so users of the package can share one copy with their other dependencies. `optionalDependencies`, which hold the per-target native packages, stay exact.