@r_masseater/msch 0.94.0 → 0.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +1 -1
  2. package/dist/{base-revision-C9RxuIMK.mjs → base-revision-Bl-4nxAd.mjs} +2 -2
  3. package/dist/{base-revision-C9RxuIMK.mjs.map → base-revision-Bl-4nxAd.mjs.map} +1 -1
  4. package/dist/cargo-inputs.mjs +2 -2
  5. package/dist/changed.mjs +5 -5
  6. package/dist/cli.mjs +747 -444
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/config-BBdsNPSO.mjs.map +1 -1
  9. package/dist/config.d.mts +19 -16
  10. package/dist/config.mjs +23 -161
  11. package/dist/config.mjs.map +1 -1
  12. package/dist/decision-rules.d.mts +1 -1
  13. package/dist/decision-rules.mjs +1 -1
  14. package/dist/{define-lint-preset-GWsBHDRn.mjs → define-lint-preset-B-hC9_df.mjs} +91 -57
  15. package/dist/define-lint-preset-B-hC9_df.mjs.map +1 -0
  16. package/dist/exits.mjs +4 -4
  17. package/dist/{ignored-directories-Ce-45yzO.mjs → ignored-directories-D-7Rm_2X.mjs} +2 -2
  18. package/dist/{ignored-directories-Ce-45yzO.mjs.map → ignored-directories-D-7Rm_2X.mjs.map} +1 -1
  19. package/dist/{index-Bw2kfEek.d.mts → index-CEazCJ_w.d.mts} +38 -11
  20. package/dist/{index-CMyIrsah.d.mts → index-Dm0Gg9wS.d.mts} +2 -2
  21. package/dist/judge.mjs +4 -4
  22. package/dist/lint-rules.mjs +23 -11
  23. package/dist/lint-rules.mjs.map +1 -1
  24. package/dist/lint.d.mts +2 -2
  25. package/dist/lint.mjs +1 -1
  26. package/dist/{lookup-report-DVJg0K4Z.mjs → lookup-report-L5OLXRMf.mjs} +3 -3
  27. package/dist/{lookup-report-DVJg0K4Z.mjs.map → lookup-report-L5OLXRMf.mjs.map} +1 -1
  28. package/dist/{manifest-texts-B69vIp7o.mjs → manifest-texts-DPgsV8kj.mjs} +2 -2
  29. package/dist/{manifest-texts-B69vIp7o.mjs.map → manifest-texts-DPgsV8kj.mjs.map} +1 -1
  30. package/dist/{output-B_YPmKad.mjs → output-DAvdel9H.mjs} +3 -3
  31. package/dist/{output-B_YPmKad.mjs.map → output-DAvdel9H.mjs.map} +1 -1
  32. package/dist/oxlint.mjs +2 -2
  33. package/dist/package-routes-BQWX5ttU.mjs +73 -0
  34. package/dist/package-routes-BQWX5ttU.mjs.map +1 -0
  35. package/dist/{package-versions-PMKDR-bJ.mjs → package-versions-sx15IGwA.mjs} +4 -4
  36. package/dist/{package-versions-PMKDR-bJ.mjs.map → package-versions-sx15IGwA.mjs.map} +1 -1
  37. package/dist/{pass-records-CBvMwfN3.mjs → pass-records-BcAAWgiQ.mjs} +4 -4
  38. package/dist/{pass-records-CBvMwfN3.mjs.map → pass-records-BcAAWgiQ.mjs.map} +1 -1
  39. package/dist/{problem-CUIz4TEI.mjs → problem-DbuTeNvL.mjs} +2 -2
  40. package/dist/{problem-CUIz4TEI.mjs.map → problem-DbuTeNvL.mjs.map} +1 -1
  41. package/dist/publish.mjs +23 -87
  42. package/dist/publish.mjs.map +1 -1
  43. package/dist/{published-B5LA4ZlS.mjs → published-3eokcs_D.mjs} +23 -5
  44. package/dist/published-3eokcs_D.mjs.map +1 -0
  45. package/dist/published.mjs +15 -18
  46. package/dist/published.mjs.map +1 -1
  47. package/dist/refs.mjs +6 -7
  48. package/dist/refs.mjs.map +1 -1
  49. package/dist/registries-DePiYd3D.mjs +11 -0
  50. package/dist/registries-DePiYd3D.mjs.map +1 -0
  51. package/dist/{registry-releases-Dj6jH8Yt.mjs → registry-releases-BBtz4wGE.mjs} +3 -3
  52. package/dist/registry-releases-BBtz4wGE.mjs.map +1 -0
  53. package/dist/{repository-files-B6PEvKWe.mjs → repository-files-DSwKJnrj.mjs} +6 -1
  54. package/dist/repository-files-DSwKJnrj.mjs.map +1 -0
  55. package/dist/repository-text-DGfYd5Wq.mjs +178 -0
  56. package/dist/repository-text-DGfYd5Wq.mjs.map +1 -0
  57. package/dist/{runtime-C8OGDSk9.mjs → runtime-Djm7zMwu.mjs} +2 -2
  58. package/dist/{runtime-C8OGDSk9.mjs.map → runtime-Djm7zMwu.mjs.map} +1 -1
  59. package/dist/unbumped.mjs +5 -5
  60. package/dist/{upstream-exits-nTTh2qcD.mjs → upstream-exits-4bn4gblF.mjs} +6 -7
  61. package/dist/{upstream-exits-nTTh2qcD.mjs.map → upstream-exits-4bn4gblF.mjs.map} +1 -1
  62. package/dist/{upstream-record-DlluH3fY.mjs → upstream-record-DRNGym9S.mjs} +2 -2
  63. package/dist/{upstream-record-DlluH3fY.mjs.map → upstream-record-DRNGym9S.mjs.map} +1 -1
  64. package/dist/upstream.mjs +7 -8
  65. package/dist/upstream.mjs.map +1 -1
  66. package/dist/{workspace-projects-B-vCr6bx.mjs → workspace-projects-MpL8K7Nz.mjs} +2 -2
  67. package/dist/{workspace-projects-B-vCr6bx.mjs.map → workspace-projects-MpL8K7Nz.mjs.map} +1 -1
  68. package/dist/workspace-settings.d.mts +1 -1
  69. package/dist/workspace-settings.mjs +50 -31
  70. package/dist/workspace-settings.mjs.map +1 -1
  71. package/package.json +10 -11
  72. package/skills/msch-checks/SKILL.md +3 -3
  73. package/skills/msch-publishing/SKILL.md +4 -4
  74. package/skills/msch-repository-config/SKILL.md +40 -42
  75. package/skills/msch-workspace-settings/SKILL.md +8 -9
  76. package/src/app/vite.d.ts +4 -37
  77. package/dist/credential-broker-PkIpsaMh.mjs +0 -29
  78. package/dist/credential-broker-PkIpsaMh.mjs.map +0 -1
  79. package/dist/define-lint-preset-GWsBHDRn.mjs.map +0 -1
  80. package/dist/owner-settings-BAh-fFKg.mjs +0 -122
  81. package/dist/owner-settings-BAh-fFKg.mjs.map +0 -1
  82. package/dist/package-routes-DQmhjX07.mjs +0 -82
  83. package/dist/package-routes-DQmhjX07.mjs.map +0 -1
  84. package/dist/published-B5LA4ZlS.mjs.map +0 -1
  85. package/dist/registry-releases-Dj6jH8Yt.mjs.map +0 -1
  86. package/dist/repository-files-B6PEvKWe.mjs.map +0 -1
  87. package/dist/wake.d.mts +0 -1
  88. package/dist/wake.mjs +0 -34
  89. package/dist/wake.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"problem-CUIz4TEI.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/syntax.ts","../src/shared/lib/problem.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isPropertyAccessExpression,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nexport const isOutsideDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n program.isSourceFileDefaultLibrary(declaration.getSourceFile()) ||\n isExternalDeclaration(program)(declaration);\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAtLocation =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node));\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n symbolAtLocation(checker)(node).pipe(Option.map(resolvedSymbol(checker)));\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isInsideAny =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst membersOf = (declaration: Node): readonly Node[] => {\n if (isInterfaceDeclaration(declaration) || isClassDeclaration(declaration)) {\n return declaration.members;\n }\n if (isTypeAliasDeclaration(declaration) && isTypeLiteralNode(declaration.type)) {\n return declaration.type.members;\n }\n return [];\n};\n\nconst isTagNamed =\n (name: string) =>\n (member: Node): boolean =>\n (isPropertySignatureDeclaration(member) || isPropertyDeclaration(member)) &&\n pipe(\n Option.fromUndefinedOr(member.type),\n Option.exists(\n (type) =>\n isLiteralTypeNode(type) && isStringLiteral(type.literal) && type.literal.text === name,\n ),\n );\n\nexport const declaresAType = (declarations: readonly Node[]): boolean =>\n pipe(\n declarations,\n Arr.some((declaration) => isTypeDeclaration(declaration) || isClassDeclaration(declaration)),\n );\n\nexport const carriesTag =\n (name: string) =>\n (declarations: readonly Node[]): boolean =>\n pipe(declarations, Arr.flatMap(membersOf), Arr.some(isTagNamed(name)));\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nexport const moduleSpecifierLiteralOf = (statement: Node): Option.Option<StringLiteral> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));\n};\n\nexport const moduleSpecifierOf = (statement: Node): Option.Option<string> =>\n Option.map(moduleSpecifierLiteralOf(statement), (specifier) => specifier.text);\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.String.check(Schema.isPattern(/^[a-z]+(?:-[a-z]+)*$/u));\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nconst FIRST = 1;\n\nexport interface Position {\n readonly line: number;\n readonly column: number;\n}\n\nexport const problemAtPosition =\n (rule: RuleName) =>\n (file: string, { line, column }: Readonly<Position>, message: string): Problem => ({\n file,\n line,\n column,\n rule,\n message,\n });\n\nexport const problemInFile =\n (rule: RuleName) =>\n (file: string, message: string): Problem =>\n problemAtPosition(rule)(file, { line: FIRST, column: FIRST }, message);\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(probl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AM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAa,gBAAgB,aAC3BA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAa,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAE1F,MAAa,iBACV,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO"}
1
+ {"version":3,"file":"problem-DbuTeNvL.mjs","names":["Arr","Str","Arr"],"sources":["../src/shared/lib/syntax.ts","../src/shared/lib/problem.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isClassDeclaration,\n isEnumDeclaration,\n isExportAssignment,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isLiteralTypeNode,\n isPropertyAccessExpression,\n isPropertyDeclaration,\n isPropertySignatureDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n isTypeLiteralNode,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n Expression,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n StringLiteral,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./repository-files.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nexport const POSITION_BASE = 1;\n\nexport const uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nexport const childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst SCOPE_PREFIX = \"@\";\nconst SCOPED_SEGMENTS = 2;\nconst UNSCOPED_SEGMENTS = 1;\n\nexport const packageOf = (fileName: string): string => {\n const afterModules = pipe(\n fileName,\n Str.lastIndexOf(NODE_MODULES_SEGMENT),\n Option.match({\n onNone: () => fileName,\n onSome: (index) => Str.slice(index + NODE_MODULES_SEGMENT.length)(fileName),\n }),\n );\n const segments = Str.split(\"/\")(afterModules);\n if (Str.startsWith(SCOPE_PREFIX)(afterModules)) {\n return pipe(Arr.take(segments, SCOPED_SEGMENTS), Arr.join(\"/\"));\n }\n return pipe(Arr.take(segments, UNSCOPED_SEGMENTS), Arr.join(\"/\"));\n};\n\nexport const descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n !program.isSourceFileDefaultLibrary(sourceFile) &&\n (Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile));\n\nexport const isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nexport const isOutsideDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n program.isSourceFileDefaultLibrary(declaration.getSourceFile()) ||\n isExternalDeclaration(program)(declaration);\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nexport const declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isEntityName = (expression: Expression): boolean =>\n isIdentifier(expression) ||\n (isPropertyAccessExpression(expression) && isEntityName(expression.expression));\n\nconst aliasesAnEntity = (declaration: Node): boolean =>\n !isExportAssignment(declaration) || isEntityName(declaration.expression);\n\nconst isAliasDeclaration = (declaration: Node): boolean =>\n ALIAS_KINDS.has(declaration.kind) && aliasesAnEntity(declaration);\n\nexport const resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nexport const symbolAtLocation =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node));\n\nexport const symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n symbolAtLocation(checker)(node).pipe(Option.map(resolvedSymbol(checker)));\n\nexport const referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nexport const lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nexport const columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nexport const contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nexport const isInsideAny =\n (outers: readonly Node[]) =>\n (node: Node): boolean =>\n pipe(\n outers,\n Arr.some((outer) => contains(outer)(node)),\n );\n\nexport const isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst membersOf = (declaration: Node): readonly Node[] => {\n if (isInterfaceDeclaration(declaration) || isClassDeclaration(declaration)) {\n return declaration.members;\n }\n if (isTypeAliasDeclaration(declaration) && isTypeLiteralNode(declaration.type)) {\n return declaration.type.members;\n }\n return [];\n};\n\nconst isTagNamed =\n (name: string) =>\n (member: Node): boolean =>\n (isPropertySignatureDeclaration(member) || isPropertyDeclaration(member)) &&\n pipe(\n Option.fromUndefinedOr(member.type),\n Option.exists(\n (type) =>\n isLiteralTypeNode(type) && isStringLiteral(type.literal) && type.literal.text === name,\n ),\n );\n\nexport const declaresAType = (declarations: readonly Node[]): boolean =>\n pipe(\n declarations,\n Arr.some((declaration) => isTypeDeclaration(declaration) || isClassDeclaration(declaration)),\n );\n\nexport const carriesTag =\n (name: string) =>\n (declarations: readonly Node[]): boolean =>\n pipe(declarations, Arr.flatMap(membersOf), Arr.some(isTagNamed(name)));\n\nexport const isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nexport const propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nexport const moduleSpecifierLiteralOf = (statement: Node): Option.Option<StringLiteral> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));\n};\n\nexport const moduleSpecifierOf = (statement: Node): Option.Option<string> =>\n Option.map(moduleSpecifierLiteralOf(statement), (specifier) => specifier.text);\n\nexport const importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.String.check(Schema.isPattern(/^[a-z]+(?:-[a-z]+)*$/u));\n\nexport type RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\nexport type Problem = typeof ProblemSchema.Type;\n\nexport const ProblemList = Schema.Array(ProblemSchema);\n\nexport const CANDIDATE_LIMIT = 3;\n\nconst FIRST = 1;\n\nexport interface Position {\n readonly line: number;\n readonly column: number;\n}\n\nexport const problemAtPosition =\n (rule: RuleName) =>\n (file: string, { line, column }: Readonly<Position>, message: string): Problem => ({\n file,\n line,\n column,\n rule,\n message,\n });\n\nexport const problemInFile =\n (rule: RuleName) =>\n (file: string, message: string): Problem =>\n problemAtPosition(rule)(file, { line: FIRST, column: FIRST }, message);\n\nexport interface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nexport const problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nexport const sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nexport const describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nexport const formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n"],"mappings":";;;;;;AAmCA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAa,qBAA2B,UACtCA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAa,cAAc,SAAgC;CACzD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,MAAa,aAAa,aAA6B;CACrD,MAAM,eAAe,KACnB,UACAC,SAAI,YAAY,oBAAoB,GACpC,OAAO,MAAM;EACX,cAAc;EACd,SAAS,UAAUA,SAAI,MAAM,QAAQ,qBAAqB,MAAM,CAAC,CAAC,QAAQ;CAC5E,CAAC,CACH;CACA,MAAM,WAAWA,SAAI,MAAM,GAAG,CAAC,CAAC,YAAY;CAC5C,IAAIA,SAAI,WAAW,YAAY,CAAC,CAAC,YAAY,GAC3C,OAAO,KAAKD,MAAI,KAAK,UAAU,eAAe,GAAGA,MAAI,KAAK,GAAG,CAAC;CAEhE,OAAO,KAAKA,MAAI,KAAK,UAAU,iBAAiB,GAAGA,MAAI,KAAK,GAAG,CAAC;AAClE;AAEA,MAAa,iBAAiB,SAC5B,KAC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BACV,UACA,MAAc,YACb,kBAAkB,IAAI,CAAC,CAAC,MAAM;CAAE,MAAM;CAAO,QAAQ;AAAM,GAAG,OAAO;AAOzE,MAAa,aACV,EAAE,MAAM,eACR,UAAyB;CACxB,MAAM,KAAK,cAAc,CAAC,CAAC;CAC3B,MAAM,OAAO,IAAI;CACjB,QAAQ,SAAS,IAAI;CACrB;CACA;AACF;AAEF,MAAM,eAAqC,MAAM,WAAW;CAC1D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,MAAM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAa,gBAAgB,aAC3BA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAa,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAE1F,MAAa,iBACV,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO"}
package/dist/publish.mjs CHANGED
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { t as runCli } from "./runtime-C8OGDSk9.mjs";
3
- import { i as ownerSettings, r as isPublicRegistry } from "./owner-settings-BAh-fFKg.mjs";
4
- import { n as repositoryBroker, t as actionsOidcToken } from "./credential-broker-PkIpsaMh.mjs";
2
+ import { t as runCli } from "./runtime-Djm7zMwu.mjs";
3
+ import { n as PUBLIC_REGISTRY } from "./registries-DePiYd3D.mjs";
5
4
  import { Array, Config, Console, Effect, FileSystem, Option, Order, Path, Predicate, Record, Schedule, Schema, Stdio, String as String$1, pipe } from "effect";
6
5
  import { PACKAGE_JSON_FILE, ROOT_SUBPATH, exportEntriesOf, importSpecifierOf, runtimeDependencyNames, unscopedNameOf } from "@r_masseater/masseater-utils/kestrion";
7
6
  import { decodePackageJson, readPackageJson, readRawPackageJson, readVersionedPackageJson, updatePackageJson, writePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
8
7
  import semver from "semver";
9
- import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
8
+ import { HttpClient, HttpClientResponse } from "effect/http";
10
9
  import { dual } from "effect/Function";
11
- import { finished, mask, mustSucceed, outputOf, succeeds, writeOutputs } from "@r_masseater/masseater-utils/github-workflow";
10
+ import { finished, mustSucceed, outputOf, succeeds, writeOutputs } from "@r_masseater/masseater-utils/github-workflow";
12
11
  import { arch, platform } from "node:os";
13
12
  import { Base64 } from "effect/encoding";
14
13
  // src/features/publish-workspace/model/export-targets.ts
@@ -154,7 +153,6 @@ const loadsCleanly = ({ runtime, consumer, failure, args }) => mustSucceed({
154
153
  const PLUGIN_FILE = ".claude-plugin/plugin.json";
155
154
  const PACKED_ROOT = "package";
156
155
  const NPM_LOCK$1 = "package-lock.json";
157
- const NPM_REGISTRY = "https://registry.npmjs.org/";
158
156
  const MINIMUM_RELEASE_AGE_DAYS = 1;
159
157
  const SCOPE = /^@[^/]+\//u;
160
158
  /** @internal */
@@ -199,7 +197,7 @@ const npmLock = (root, flags) => mustSucceed({
199
197
  args: [
200
198
  "install",
201
199
  "--package-lock-only",
202
- `--registry=${NPM_REGISTRY}`,
200
+ `--registry=${PUBLIC_REGISTRY}`,
203
201
  ...flags,
204
202
  ...NPM_QUIET
205
203
  ],
@@ -645,33 +643,6 @@ const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory)
645
643
  });
646
644
  return yield* checkPluginInstall(directory, manifest, tarballsFor({})(local));
647
645
  }, Effect.scoped);
648
- // src/features/publish-workspace/model/broker.ts
649
- const Issued = Schema.Record(Schema.String, Schema.Unknown);
650
- const issued = Effect.fn("publish.issued")(function* issued(broker, oidc, { kind, field }) {
651
- const client = yield* HttpClient.HttpClient;
652
- const request = HttpClientRequest.post(`${broker.url}?only=${kind}`).pipe(HttpClientRequest.bearerToken(oidc));
653
- const response = yield* HttpClient.filterStatusOk(client).execute(request);
654
- const body = yield* HttpClientResponse.schemaBodyJson(Issued)(response);
655
- const token = Option.filter(Option.fromNullishOr(body[field]), (value) => typeof value === "string" && value !== "");
656
- yield* Effect.forEach(Option.toArray(token), mask, {
657
- concurrency: 1,
658
- discard: true
659
- });
660
- return token;
661
- });
662
- /** @internal */
663
- const credentialFrom = Effect.fn("publish.credentialFrom")(function* credentialFrom(broker, credential) {
664
- if (Option.isNone(broker)) return Option.none();
665
- return yield* actionsOidcToken(broker.value).pipe(Effect.flatMap(Option.match({
666
- onNone: () => Effect.succeedNone,
667
- onSome: (oidc) => issued(broker.value, oidc, credential)
668
- })), Effect.tapError(() => Console.log(`The credential broker gave no ${credential.field}`)), Effect.orElseSucceed(() => Option.none()));
669
- });
670
- /** @internal */
671
- const brokerCredential = Effect.fn("publish.brokerCredential")(function* brokerCredential(credential) {
672
- const broker = yield* repositoryBroker;
673
- return yield* credentialFrom(broker, credential);
674
- });
675
646
  // src/features/publish-workspace/model/consumer-build.ts
676
647
  const PNPMFILE = ".pnpmfile.cjs";
677
648
  const TASK = "msch";
@@ -904,14 +875,7 @@ const dependentsOf = (known) => (names) => {
904
875
  if (Array.isReadonlyArrayEmpty(added)) return names;
905
876
  return dependentsOf(known)([...names, ...added]);
906
877
  };
907
- const tokenOf = Effect.fn("consumers.token")(function* tokenOf() {
908
- const given = yield* Config.option(Config.String("GITHUB_APP_TOKEN"));
909
- if (Option.isSome(given)) return given;
910
- return yield* brokerCredential({
911
- kind: "github",
912
- field: "githubToken"
913
- });
914
- });
878
+ const tokenOf = Config.option(Config.String("GITHUB_APP_TOKEN"));
915
879
  const selfOf = Effect.fn("consumers.self")(function* selfOf() {
916
880
  const given = yield* Config.option(Config.String("GITHUB_REPOSITORY"));
917
881
  if (Option.isSome(given)) return given.value;
@@ -974,7 +938,7 @@ const verified = Effect.fn("consumers.verified")(function* verified(directories,
974
938
  /** @internal */
975
939
  const checkConsumers = Effect.fn("publish.consumers")(function* checkConsumers(directories) {
976
940
  if (Array.isReadonlyArrayEmpty(directories)) return yield* Effect.void;
977
- const token = yield* tokenOf();
941
+ const token = yield* tokenOf;
978
942
  const found = yield* consumersAffected(directories, token);
979
943
  if (Option.isNone(found)) return yield* unlisted();
980
944
  return yield* verified(directories, found.value, token);
@@ -1002,31 +966,24 @@ const WORKSPACE_PROTOCOL = "workspace:";
1002
966
  const READ_CONCURRENCY = 8;
1003
967
  const WAIT_INTERVAL = "30 seconds";
1004
968
  const WAIT_ATTEMPTS = 120;
1005
- const REPOSITORY_ROOT = ".";
1006
- const PUBLIC_FLAGS = [
969
+ /** @internal */
970
+ const REGISTRY_FLAGS = ["--registry", PUBLIC_REGISTRY];
971
+ /** @internal */
972
+ const PUBLISH_FLAGS = [
1007
973
  "--provenance",
1008
974
  "--access",
1009
- "public"
975
+ "public",
976
+ ...REGISTRY_FLAGS
1010
977
  ];
1011
978
  /** @internal */
1012
- const publishRegistry = Effect.map(ownerSettings(REPOSITORY_ROOT), ({ publishRegistry: registry }) => registry);
1013
- /** @internal */
1014
- const registryFlags = (registry) => ["--registry", registry];
1015
- /** @internal */
1016
- const publishFlags = (registry) => {
1017
- if (isPublicRegistry(registry)) return [...PUBLIC_FLAGS, ...registryFlags(registry)];
1018
- return registryFlags(registry);
1019
- };
1020
- /** @internal */
1021
979
  const onNpm = Effect.fn("publish.onNpm")(function* onNpm({ directory, name, version }) {
1022
- const registry = yield* publishRegistry;
1023
980
  return yield* succeeds({
1024
981
  command: "npm",
1025
982
  args: [
1026
983
  "view",
1027
984
  `${name}@${version}`,
1028
985
  "version",
1029
- ...registryFlags(registry)
986
+ ...REGISTRY_FLAGS
1030
987
  ],
1031
988
  cwd: directory
1032
989
  });
@@ -1078,8 +1035,6 @@ const Attestations = Schema.Struct({ attestations: Schema.Array(Attestation) });
1078
1035
  const commitOf = (repository) => (payload) => pipe(Base64.decodeString(payload), Effect.fromResult, Effect.flatMap(Schema.decodeEffect(Statement)), Effect.map(({ predicate }) => pipe(Array.head(predicate.buildDefinition.resolvedDependencies), Option.filter(({ uri }) => String$1.includes(`github.com/${repository}@`)(uri)), Option.map(({ digest }) => digest.gitCommit))), Effect.orElseSucceed(() => Option.none()));
1079
1036
  /** @internal */
1080
1037
  const provenanceCommit = Effect.fn("publish.provenanceCommit")(function* provenanceCommit({ name, version }) {
1081
- const registry = yield* publishRegistry;
1082
- if (!isPublicRegistry(registry)) return Option.none();
1083
1038
  const client = yield* HttpClient.HttpClient;
1084
1039
  const repository = yield* Config.String("GITHUB_REPOSITORY");
1085
1040
  const url = `${ATTESTATIONS}${String$1.replace("/", "%2f")(name)}@${version}`;
@@ -1099,10 +1054,7 @@ const tagged = Effect.fn("publish.tagged")(function* tagged(tag) {
1099
1054
  args: ["api", `repos/${repository}/git/ref/tags/${tag}`]
1100
1055
  });
1101
1056
  });
1102
- const tokenEnv = brokerCredential({
1103
- kind: "github",
1104
- field: "githubToken"
1105
- }).pipe(Effect.map(Option.match({
1057
+ const tokenEnv = Config.option(Config.String("GITHUB_APP_TOKEN")).pipe(Effect.map(Option.match({
1106
1058
  onNone: () => ({}),
1107
1059
  onSome: (value) => ({ GH_TOKEN: value })
1108
1060
  })));
@@ -1128,8 +1080,7 @@ const createTag = Effect.fn("publish.createTag")(function* createTag({ tag, sha
1128
1080
  });
1129
1081
  const isRelease = (version) => version !== UNVERSIONED && semver.valid(version) !== null && semver.prerelease(version) === null;
1130
1082
  const publishedVersions = Effect.fn("publish.publishedVersions")(function* publishedVersions({ directory, manifest }) {
1131
- const registry = yield* publishRegistry;
1132
- if (!goesToNpm(manifest) || !isPublicRegistry(registry)) return [];
1083
+ if (!goesToNpm(manifest)) return [];
1133
1084
  const text = yield* outputOf({
1134
1085
  command: "npm",
1135
1086
  args: [
@@ -1137,7 +1088,7 @@ const publishedVersions = Effect.fn("publish.publishedVersions")(function* publi
1137
1088
  manifest.name,
1138
1089
  "versions",
1139
1090
  "--json",
1140
- ...registryFlags(registry)
1091
+ ...REGISTRY_FLAGS
1141
1092
  ],
1142
1093
  cwd: directory
1143
1094
  }).pipe(Effect.orElseSucceed(() => "[]"));
@@ -1412,16 +1363,6 @@ const checkChangedCompat = Effect.fn("publish.compatChanged")(function* checkCha
1412
1363
  return yield* checkConsumers(checked);
1413
1364
  });
1414
1365
  // src/features/publish-workspace/model/npm.ts
1415
- const authEnv = Effect.fn("publish.authEnv")(function* authEnv() {
1416
- const token = yield* brokerCredential({
1417
- kind: "npm",
1418
- field: "npmToken"
1419
- });
1420
- return Option.match(token, {
1421
- onNone: () => ({}),
1422
- onSome: (value) => ({ NODE_AUTH_TOKEN: value })
1423
- });
1424
- });
1425
1366
  const verifyPackage = Effect.fn("publish.verify")(function* verifyPackage(directory, manifest) {
1426
1367
  const tasks = [
1427
1368
  "build",
@@ -1439,8 +1380,7 @@ const verifyPackage = Effect.fn("publish.verify")(function* verifyPackage(direct
1439
1380
  yield* checkExportTargets(directory);
1440
1381
  yield* checkCompat(directory);
1441
1382
  });
1442
- const publishNative = Effect.fn("publish.publishNative")(function* publishNative(target, env) {
1443
- const registry = yield* publishRegistry;
1383
+ const publishNative = Effect.fn("publish.publishNative")(function* publishNative(target) {
1444
1384
  const { name, version } = yield* readVersionedPackageJson(target);
1445
1385
  if (yield* onNpm({
1446
1386
  directory: target,
@@ -1455,15 +1395,14 @@ const publishNative = Effect.fn("publish.publishNative")(function* publishNative
1455
1395
  args: [
1456
1396
  "publish",
1457
1397
  ".",
1458
- ...publishFlags(registry)
1398
+ ...PUBLISH_FLAGS
1459
1399
  ],
1460
- env,
1461
1400
  cwd: target
1462
1401
  });
1463
1402
  return name;
1464
1403
  });
1465
1404
  const addOptionalDependencies = (directory, names, version) => updatePackageJson(directory, { optionalDependencies: pipe(names, Array.map((name) => [name, version]), Record.fromEntries) }).pipe(Effect.withSpan("publish.optionalDependencies"));
1466
- const publishNatives = Effect.fn("publish.publishNatives")(function* publishNatives(directory, manifest, env) {
1405
+ const publishNatives = Effect.fn("publish.publishNatives")(function* publishNatives(directory, manifest) {
1467
1406
  if (Predicate.isUndefined(manifest.native)) return;
1468
1407
  const { binary, targets } = manifest.native;
1469
1408
  const written = yield* Effect.forEach(targets, (target) => writeNative(directory, {
@@ -1472,7 +1411,7 @@ const publishNatives = Effect.fn("publish.publishNatives")(function* publishNati
1472
1411
  binary,
1473
1412
  target
1474
1413
  }), { concurrency: 1 });
1475
- const names = yield* Effect.forEach(written, (target) => publishNative(target, env), { concurrency: 1 });
1414
+ const names = yield* Effect.forEach(written, publishNative, { concurrency: 1 });
1476
1415
  yield* addOptionalDependencies(directory, names, manifest.version);
1477
1416
  });
1478
1417
  /** @internal */
@@ -1483,18 +1422,15 @@ const publishToNpm = Effect.fn("publish.npm")(function* publishToNpm(directory)
1483
1422
  ...manifest
1484
1423
  })) return yield* Console.log(`${manifest.name}@${manifest.version} is already published`);
1485
1424
  yield* verifyPackage(directory, manifest);
1486
- const env = yield* authEnv();
1487
- yield* publishNatives(directory, manifest, env);
1425
+ yield* publishNatives(directory, manifest);
1488
1426
  const tarball = yield* pack(directory);
1489
- const registry = yield* publishRegistry;
1490
1427
  return yield* mustSucceed({
1491
1428
  command: "npm",
1492
1429
  args: [
1493
1430
  "publish",
1494
1431
  tarball,
1495
- ...publishFlags(registry)
1432
+ ...PUBLISH_FLAGS
1496
1433
  ],
1497
- env,
1498
1434
  cwd: directory
1499
1435
  });
1500
1436
  }, Effect.scoped);