@r_masseater/msch 0.134.1 → 0.141.2

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 (55) hide show
  1. package/dist/addon-tasks.mjs +1 -1
  2. package/dist/build-workspace-settings-Dv5SXt_j.mjs +648 -0
  3. package/dist/build-workspace-settings-Dv5SXt_j.mjs.map +1 -0
  4. package/dist/cargo-inputs.mjs +1 -1
  5. package/dist/cli.mjs +708 -750
  6. package/dist/cli.mjs.map +1 -1
  7. package/dist/config.d.mts +13 -37
  8. package/dist/config.mjs +335 -23
  9. package/dist/config.mjs.map +1 -1
  10. package/dist/decision-rules-CqgOVodl.mjs +43 -0
  11. package/dist/decision-rules-CqgOVodl.mjs.map +1 -0
  12. package/dist/decision-rules.d.mts +2 -1
  13. package/dist/decision-rules.mjs +1 -1
  14. package/dist/{dependencies-Bjn3xWkq.mjs → dependencies-DgltkhvK.mjs} +2 -2
  15. package/dist/{dependencies-Bjn3xWkq.mjs.map → dependencies-DgltkhvK.mjs.map} +1 -1
  16. package/dist/{derive-cargo-inputs-BLMqkRS3.mjs → derive-cargo-inputs-DbMOBcGP.mjs} +3 -3
  17. package/dist/{derive-cargo-inputs-BLMqkRS3.mjs.map → derive-cargo-inputs-DbMOBcGP.mjs.map} +1 -1
  18. package/dist/{ignored-directories-CaTFIbjo.mjs → ignored-directories-BGiOSvNx.mjs} +2 -2
  19. package/dist/{ignored-directories-CaTFIbjo.mjs.map → ignored-directories-BGiOSvNx.mjs.map} +1 -1
  20. package/dist/index-DOkaGaUe.d.mts +25 -0
  21. package/dist/library.mjs +2 -2
  22. package/dist/lint.d.mts +38 -2
  23. package/dist/lint.mjs +20 -1
  24. package/dist/lint.mjs.map +1 -0
  25. package/dist/oxlint.mjs +2 -2
  26. package/dist/{problem-Dk1svgmC.mjs → problem-CkDaLJxX.mjs} +2 -2
  27. package/dist/{problem-Dk1svgmC.mjs.map → problem-CkDaLJxX.mjs.map} +1 -1
  28. package/dist/{published-Cgl1qeYH.mjs → published-BrX24558.mjs} +269 -8
  29. package/dist/published-BrX24558.mjs.map +1 -0
  30. package/dist/{repository-files-C_GzAnYp.mjs → repository-files-CX48nfE5.mjs} +4 -5
  31. package/dist/repository-files-CX48nfE5.mjs.map +1 -0
  32. package/dist/{define-lint-preset-_bDnJMcY.mjs → repository-text-CpD8Z1kp.mjs} +355 -380
  33. package/dist/repository-text-CpD8Z1kp.mjs.map +1 -0
  34. package/dist/traced-rules.config-CnYNZrOa.mjs +8 -0
  35. package/dist/traced-rules.config-CnYNZrOa.mjs.map +1 -0
  36. package/dist/workspace-settings.mjs +2 -434
  37. package/dist/zenn-markdown.config-uksui7Go.mjs +77 -0
  38. package/dist/zenn-markdown.config-uksui7Go.mjs.map +1 -0
  39. package/package.json +13 -13
  40. package/skills/msch-checks/SKILL.md +5 -5
  41. package/skills/msch-publishing/SKILL.md +1 -1
  42. package/skills/msch-repository-config/SKILL.md +19 -18
  43. package/skills/msch-workspace-settings/SKILL.md +17 -9
  44. package/src/app/vite.d.ts +5 -8
  45. package/dist/define-lint-preset-_bDnJMcY.mjs.map +0 -1
  46. package/dist/index-_y7Igwy0.d.mts +0 -321
  47. package/dist/published-Cgl1qeYH.mjs.map +0 -1
  48. package/dist/repository-files-C_GzAnYp.mjs.map +0 -1
  49. package/dist/repository-text-BPhi-pct.mjs +0 -331
  50. package/dist/repository-text-BPhi-pct.mjs.map +0 -1
  51. package/dist/required-stack-BLSiAmpx.mjs +0 -188
  52. package/dist/required-stack-BLSiAmpx.mjs.map +0 -1
  53. package/dist/workspace-projects-Zg078aA1.mjs +0 -269
  54. package/dist/workspace-projects-Zg078aA1.mjs.map +0 -1
  55. package/dist/workspace-settings.mjs.map +0 -1
@@ -1,11 +1,272 @@
1
- import { r as RepositoryFiles, s as groupOf } from "./repository-files-C_GzAnYp.mjs";
2
- import { C as childrenOf, S as KeySchema, k as stringsIn, w as keyName } from "./workspace-projects-Zg078aA1.mjs";
3
- import { Array, Effect, Option, Predicate, Record, Schema, String, pipe } from "effect";
4
- import { readWantedLockfile } from "@r_masseater/masseater-utils/kestrion/pnpm";
1
+ import { r as RepositoryFiles } from "./repository-files-CX48nfE5.mjs";
2
+ import { Array, Effect, Match, Option, Order, Predicate, Record, Schema, String, pipe } from "effect";
3
+ import { groupOf } from "@r_masseater/masseater-utils/text";
4
+ import { findWorkspaceProjects, readWantedLockfile, readWorkspaceManifest } from "@r_masseater/masseater-utils/kestrion/pnpm";
5
5
  import { PACKAGE_JSON_FILE, binEntriesOf, exportEntriesOf, targetsIn } from "@r_masseater/masseater-utils/kestrion";
6
6
  import { decodePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
7
- import { parse, resolveConfigFromFile } from "vite-plus";
7
+ import { parse } from "vite-plus";
8
+ import { resolvedViteConfig } from "@r_masseater/masseater-utils/vite-config";
8
9
  import { parse as parse$1 } from "yaml";
10
+ // src/entities/workspace/model/config-literal.ts
11
+ const WRAPPERS = [
12
+ "TSAsExpression",
13
+ "TSSatisfiesExpression",
14
+ "ParenthesizedExpression"
15
+ ];
16
+ const KeySchema = Schema.Union([Schema.Struct({
17
+ type: Schema.Literal("Identifier"),
18
+ name: Schema.String
19
+ }), Schema.Struct({
20
+ type: Schema.Literal("Literal"),
21
+ value: Schema.String
22
+ })]);
23
+ const Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });
24
+ const PropertyNode = Schema.Struct({
25
+ type: Schema.Literal("Property"),
26
+ computed: Schema.Literal(false),
27
+ key: KeySchema,
28
+ value: Schema.Unknown
29
+ });
30
+ const WrappedNode = Schema.Struct({
31
+ type: Schema.Literals(WRAPPERS),
32
+ expression: Schema.Unknown
33
+ });
34
+ const ValueNode = Schema.Union([
35
+ Schema.Struct({
36
+ type: Schema.Literal("Literal"),
37
+ value: Schema.Union([
38
+ Schema.String,
39
+ Schema.Finite,
40
+ Schema.Boolean,
41
+ Schema.Null
42
+ ])
43
+ }),
44
+ Schema.Struct({
45
+ type: Schema.Literal("TemplateLiteral"),
46
+ expressions: Schema.Tuple([]),
47
+ quasis: Schema.Array(Quasi)
48
+ }),
49
+ Schema.Struct({
50
+ type: Schema.Literal("ArrayExpression"),
51
+ elements: Schema.Array(Schema.Unknown)
52
+ }),
53
+ Schema.Struct({
54
+ type: Schema.Literal("ObjectExpression"),
55
+ properties: Schema.Array(PropertyNode)
56
+ })
57
+ ]);
58
+ const decodeWrapped = Schema.decodeUnknownOption(WrappedNode);
59
+ const decodeValue = Schema.decodeUnknownOption(ValueNode);
60
+ const decodeProperty = Schema.decodeUnknownOption(Schema.Struct({
61
+ type: Schema.Literal("Property"),
62
+ key: KeySchema,
63
+ value: Schema.Unknown
64
+ }));
65
+ const decodeObject = Schema.decodeUnknownOption(Schema.Struct({
66
+ type: Schema.Literal("ObjectExpression"),
67
+ properties: Schema.Array(Schema.Unknown)
68
+ }));
69
+ const keyName = (key) => Match.value(key).pipe(Match.discriminatorsExhaustive("type")({
70
+ Identifier: (identifier) => identifier.name,
71
+ Literal: (literal) => literal.value
72
+ }));
73
+ const literalOf = (node) => {
74
+ const wrapped = decodeWrapped(node);
75
+ if (Option.isSome(wrapped)) return literalOf(wrapped.value.expression);
76
+ return pipe(decodeValue(node), Option.flatMap((value) => Match.value(value).pipe(Match.discriminatorsExhaustive("type")({
77
+ Literal: (scalar) => Option.some(scalar.value),
78
+ TemplateLiteral: (template) => Option.some(pipe(template.quasis, Array.map((quasi) => quasi.value.cooked), Array.join(""))),
79
+ ArrayExpression: (array) => pipe(array.elements, Array.map(literalOf), Option.all),
80
+ ObjectExpression: (object) => pipe(object.properties, Array.map((property) => pipe(literalOf(property.value), Option.map((literal) => [keyName(property.key), literal]))), Option.all, Option.map(Record.fromEntries))
81
+ }))));
82
+ };
83
+ const propertyValue = (name) => (object) => pipe(decodeObject(object), Option.flatMap(({ properties }) => pipe(properties, Array.findFirst((property) => pipe(decodeProperty(property), Option.filter(({ key }) => keyName(key) === name), Option.map(({ value }) => value))))));
84
+ const childrenOf = (node) => {
85
+ if (Array.isArray(node)) return node;
86
+ if (Predicate.isReadonlyObject(node)) return Record.values(node);
87
+ return [];
88
+ };
89
+ const keyValues = (name) => (node) => [...Option.toArray(propertyValue(name)(node)), ...pipe(childrenOf(node), Array.flatMap(keyValues(name)))];
90
+ const nestedValues = (path) => (node) => {
91
+ const [outer, inner] = path;
92
+ return [...pipe(Option.some(node), Option.flatMap(propertyValue(outer)), Option.flatMap(propertyValue(inner)), Option.toArray), ...pipe(childrenOf(node), Array.flatMap(nestedValues(path)))];
93
+ };
94
+ const StringNode = Schema.Union([Schema.Struct({
95
+ type: Schema.Literal("Literal"),
96
+ value: Schema.String,
97
+ start: Schema.Finite
98
+ }), Schema.Struct({
99
+ type: Schema.Literal("TemplateElement"),
100
+ value: Schema.Struct({ cooked: Schema.String }),
101
+ start: Schema.Finite
102
+ })]);
103
+ const decodeStringNode = Schema.decodeUnknownOption(StringNode);
104
+ const textOf = (node) => {
105
+ if (node.type === "Literal") return node.value;
106
+ return node.value.cooked;
107
+ };
108
+ const stringsIn = (node) => {
109
+ return [...pipe(decodeStringNode(node), Option.map((found) => ({
110
+ text: textOf(found),
111
+ start: found.start
112
+ })), Option.toArray), ...pipe(childrenOf(node), Array.flatMap(stringsIn))];
113
+ };
114
+ // src/entities/workspace/model/workspace-config-source.ts
115
+ const SINGLE = 1;
116
+ const CONFIG_FILE$1 = "vite.config.ts";
117
+ const taggedError$1 = Schema.TaggedError;
118
+ var WorkspaceSettingsInvalid = class extends taggedError$1()("WorkspaceSettingsInvalid", {
119
+ file: Schema.String,
120
+ message: Schema.String
121
+ }) {};
122
+ const settingsInvalid = (file) => (reason) => WorkspaceSettingsInvalid.make({
123
+ file,
124
+ message: `${file}: ${reason}`
125
+ });
126
+ const notLiteral = ([outer, inner]) => `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Write the values in place instead of importing them.`;
127
+ const merged = (records) => pipe(records, Array.flatMap(Record.toEntries), Record.fromEntries);
128
+ const usedFrom = Effect.fn("usedFrom")(function* usedFrom(file, sets, used) {
129
+ const unknownSets = pipe(used, Array.filter((name) => !Record.has(sets, name)));
130
+ if (Array.isReadonlyArrayNonEmpty(unknownSets)) return yield* settingsInvalid(file)(`msch has no set named ${Array.join(unknownSets, ", ")}. Sets msch has: ${Array.join(Record.keys(sets), ", ")}.`);
131
+ return pipe(used, Array.flatMap((name) => Option.toArray(Record.get(sets, name))));
132
+ });
133
+ const singleValue = Effect.fn("singleValue")(function* singleValue(source, path) {
134
+ const found = nestedValues(path)(source.program);
135
+ if (found.length > SINGLE) return yield* settingsInvalid(source.file)(`${Array.join(path, ".")} appears more than once.`);
136
+ return Array.head(found);
137
+ });
138
+ const literalSettings = ({ source, path, decode }) => Effect.gen(function* literalSettingsIn() {
139
+ const node = yield* singleValue(source, path);
140
+ if (Option.isNone(node)) return Option.none();
141
+ const literal = literalOf(node.value);
142
+ if (Option.isNone(literal)) return yield* settingsInvalid(source.file)(notLiteral(path));
143
+ const settings = yield* decode(literal.value).pipe(Effect.mapError((error) => settingsInvalid(source.file)(error.message)));
144
+ return Option.some(settings);
145
+ });
146
+ const programOf = Effect.fn("programOf")(function* programOf(file, text) {
147
+ const parsed = yield* Effect.promise(() => parse(file, text, { lang: "ts" }));
148
+ if (Array.isReadonlyArrayNonEmpty(parsed.errors)) return yield* settingsInvalid(file)("vite.config.ts does not parse.");
149
+ return parsed.program;
150
+ });
151
+ const workspaceConfigOf = Effect.fn("workspaceConfigOf")(function* workspaceConfigOf(root, directory) {
152
+ const files = yield* RepositoryFiles;
153
+ const file = files.join(root, directory, CONFIG_FILE$1);
154
+ const text = yield* files.readFile(file);
155
+ if (Option.isNone(text)) return Option.none();
156
+ const program = yield* programOf(file, text.value);
157
+ return Option.some({
158
+ file,
159
+ source: text.value,
160
+ program
161
+ });
162
+ });
163
+ // src/entities/workspace/model/workspace-tasks.ts
164
+ const TASK_NAMES = {
165
+ verify: "verify",
166
+ test: "test",
167
+ cargoTest: "cargo-test"
168
+ };
169
+ const TEST_TASK_NAMES = [TASK_NAMES.test, TASK_NAMES.cargoTest];
170
+ const VERIFY_TASK = ["tasks", TASK_NAMES.verify];
171
+ const TEST_TASK = ["tasks", TASK_NAMES.test];
172
+ const CARGO_TEST_TASK = ["tasks", TASK_NAMES.cargoTest];
173
+ const NATIVE_TASK = ["tasks", "native"];
174
+ const RUN_TASKS = ["run", "tasks"];
175
+ const NO_TASKS = {
176
+ verify: [],
177
+ test: [],
178
+ native: []
179
+ };
180
+ const Tasks = Schema.Struct({ verify: Schema.Unknown });
181
+ const isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));
182
+ const definesTask = (path) => (program) => Array.isReadonlyArrayNonEmpty(nestedValues(path)(program));
183
+ const DEPENDS_ON = "dependsOn";
184
+ const testsInVerify = (program) => pipe(nestedValues(VERIFY_TASK)(program), Array.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))), Array.flatMap(stringsIn), Array.filter(({ text }) => text === TASK_NAMES.test));
185
+ const testsItself = (program) => definesTask(TEST_TASK)(program) || Array.isReadonlyArrayNonEmpty(testsInVerify(program));
186
+ const CargoTasks = Schema.Struct({ cargo: Schema.Unknown });
187
+ const checksCargo = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: CargoTasks }) }));
188
+ const resolvedConfig = (file) => Effect.tryPromise({
189
+ try: () => resolvedViteConfig(file),
190
+ catch: () => settingsInvalid(file)("vite.config.ts does not load.")
191
+ }).pipe(Effect.option);
192
+ const hasVerifyTask = Effect.fn("hasVerifyTask")(function* hasVerifyTask(file) {
193
+ const config = yield* resolvedConfig(file);
194
+ return Option.exists(config, isVerified);
195
+ });
196
+ const hasCargoTask = Effect.fn("hasCargoTask")(function* hasCargoTask(file) {
197
+ const config = yield* resolvedConfig(file);
198
+ return Option.exists(config, checksCargo);
199
+ });
200
+ const shipsAddon = (manifest) => Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));
201
+ const tasksOf = (manifest) => (program) => pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.name)), Option.match({
202
+ onNone: () => NO_TASKS,
203
+ onSome: (name) => ({
204
+ verify: Array.filter([`${name}#verify`], () => definesTask(VERIFY_TASK)(program)),
205
+ test: Array.getSomes([Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)), Option.liftPredicate(`${name}#cargo-test`, () => definesTask(CARGO_TEST_TASK)(program))]),
206
+ native: Array.filter([`${name}#native`], () => definesTask(NATIVE_TASK)(program) || shipsAddon(manifest))
207
+ })
208
+ }));
209
+ // src/entities/workspace/model/workspace-manifest.ts
210
+ /** @internal */
211
+ const workspaceManifest = (root) => readWorkspaceManifest(root).pipe(Effect.orElseSucceed(() => Option.none()));
212
+ // src/entities/workspace/model/workspace-projects.ts
213
+ const ROOT_DIRECTORY = "";
214
+ const byDirectory = Order.mapInput(String.Order, ({ directory }) => directory);
215
+ const projectsMatching = (root, patterns) => findWorkspaceProjects(root, patterns).pipe(Effect.orElseSucceed(() => []));
216
+ const workspacePatterns = Effect.fn("workspacePatterns")(function* workspacePatterns(root) {
217
+ const manifest = yield* workspaceManifest(root);
218
+ return pipe(manifest, Option.flatMap(({ packages }) => Option.fromNullishOr(packages)), Option.getOrElse(() => []));
219
+ });
220
+ /** @internal */
221
+ const workspaceProjects = Effect.fn("workspaceProjects")(function* workspaceProjects(root) {
222
+ const files = yield* RepositoryFiles;
223
+ const patterns = yield* workspacePatterns(root);
224
+ if (!Array.isReadonlyArrayNonEmpty(patterns)) return [];
225
+ const projects = yield* projectsMatching(root, patterns);
226
+ const found = pipe(projects, Array.map(({ rootDir, manifest: own }) => ({
227
+ directory: files.relative(root, rootDir),
228
+ packageName: Option.fromUndefinedOr(own.name),
229
+ description: Option.filter(Option.fromUndefinedOr(own.description), String.isNonEmpty),
230
+ published: own.private !== true,
231
+ keywords: Option.getOrElse(Option.fromUndefinedOr(own.keywords), () => []),
232
+ files: Option.fromUndefinedOr(own.files)
233
+ })), Array.filter(({ directory }) => String.isNonEmpty(directory)));
234
+ return Array.sort(found, byDirectory);
235
+ });
236
+ /** @internal */
237
+ const workspaceDirectories = Effect.fn("workspaceDirectories")(function* workspaceDirectories(root) {
238
+ const projects = yield* workspaceProjects(root);
239
+ return pipe(projects, Array.map(({ directory }) => directory));
240
+ });
241
+ const rootProject = Effect.fn("rootProject")(function* rootProject(root) {
242
+ const files = yield* RepositoryFiles;
243
+ const text = yield* files.readFile(files.join(root, PACKAGE_JSON_FILE));
244
+ return pipe(text, Option.flatMap(decodePackageJson), Option.filter((own) => Predicate.isNotUndefined(own.name)), Option.map((own) => ({
245
+ directory: ROOT_DIRECTORY,
246
+ packageName: Option.fromUndefinedOr(own.name),
247
+ description: Option.filter(Option.fromUndefinedOr(own.description), String.isNonEmpty),
248
+ published: own.private !== true,
249
+ keywords: own.keywords ?? [],
250
+ files: Option.fromUndefinedOr(own.files)
251
+ })));
252
+ });
253
+ /** @internal */
254
+ const publishedProjects = Effect.fn("publishedProjects")(function* publishedProjects(root) {
255
+ const [own, members] = yield* Effect.all([rootProject(root), workspaceProjects(root)], { concurrency: "unbounded" });
256
+ return pipe(Option.toArray(own), Array.appendAll(members), Array.filter(({ published }) => published));
257
+ });
258
+ const NEGATION$1 = "!";
259
+ const MATCH_CONCURRENCY = 8;
260
+ /** @internal */
261
+ const unmatchedWorkspacePatterns = Effect.fn("unmatchedWorkspacePatterns")(function* unmatchedWorkspacePatterns(root) {
262
+ const listed = yield* workspacePatterns(root);
263
+ const patterns = pipe(listed, Array.filter((pattern) => !String.startsWith(NEGATION$1)(pattern)));
264
+ const matched = yield* Effect.forEach(patterns, (pattern) => projectsMatching(root, [pattern]).pipe(Effect.map((projects) => ({
265
+ pattern,
266
+ matches: Array.isReadonlyArrayNonEmpty(projects)
267
+ }))), { concurrency: MATCH_CONCURRENCY });
268
+ return pipe(matched, Array.filter(({ matches }) => !matches), Array.map(({ pattern }) => pattern));
269
+ });
9
270
  // src/entities/workspace/model/workspace-patterns.ts
10
271
  const SEPARATOR$1 = "/";
11
272
  const NEGATION = "!";
@@ -237,7 +498,7 @@ const packEntriesOf = (pack) => pipe(packSettingsOf(pack), Array.flatMap((settin
237
498
  const alwaysBundleOf = (pack) => pipe(packSettingsOf(pack), Array.flatMap((setting) => pipe(Option.fromUndefinedOr(setting.deps), Option.flatMap((deps) => Option.fromUndefinedOr(deps.alwaysBundle)), Option.map(Array.ensure), Option.getOrElse(() => []))), Array.dedupe);
238
499
  const settingsIn = Effect.fn("settingsIn")(function* settingsIn(file) {
239
500
  return yield* Effect.tryPromise({
240
- try: () => resolveConfigFromFile(file),
501
+ try: () => resolvedViteConfig(file),
241
502
  catch: () => WorkspaceConfigUnreadable.make({ file })
242
503
  }).pipe(Effect.option);
243
504
  });
@@ -294,6 +555,6 @@ const publishedWorkspaces = Effect.fn("publishedWorkspaces")(function* published
294
555
  ...budgetOf(budget)
295
556
  })), Option.toArray)));
296
557
  });
297
- export { shadcnUiIn as _, workspaceConfigs as a, publicEntriesOf as c, FRONTMATTER as d, splitFrontmatter as f, deployEntries as g, bundledEntries as h, publishedWorkspaces as i, modDirectories as l, workspaceLinks as m, entriesOf as n, entryNameOf as o, linkedPaths as p, packedWorkspaces as r, isBinEntry as s, PackEntry as t, INDEX_SKILL as u, shadcnUiOf as v, prefixed as y };
558
+ export { definesTask as A, workspaceConfigOf as B, workspaceProjects as C, TASK_NAMES as D, RUN_TASKS as E, literalSettings as F, literalOf as G, childrenOf as H, merged as I, stringsIn as J, nestedValues as K, programOf as L, hasVerifyTask as M, tasksOf as N, TEST_TASK_NAMES as O, testsItself as P, settingsInvalid as R, workspaceDirectories as S, NO_TASKS as T, keyName as U, KeySchema as V, keyValues as W, shadcnUiIn as _, workspaceConfigs as a, publishedProjects as b, publicEntriesOf as c, FRONTMATTER as d, splitFrontmatter as f, deployEntries as g, bundledEntries as h, publishedWorkspaces as i, hasCargoTask as j, VERIFY_TASK as k, modDirectories as l, workspaceLinks as m, entriesOf as n, entryNameOf as o, linkedPaths as p, propertyValue as q, packedWorkspaces as r, isBinEntry as s, PackEntry as t, INDEX_SKILL as u, shadcnUiOf as v, workspaceManifest as w, unmatchedWorkspacePatterns as x, prefixed as y, usedFrom as z };
298
559
 
299
- //# sourceMappingURL=published-Cgl1qeYH.mjs.map
560
+ //# sourceMappingURL=published-BrX24558.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"published-BrX24558.mjs","names":["Arr","Rec","CONFIG_FILE","taggedError","Arr","Rec","Arr","sharedConfig","Str","Arr","NEGATION","SEPARATOR","Str","Str","Rec","Arr","READ_CONCURRENCY","Arr","Arr","Rec","Str","parse","Str","Str","Arr","Str","Arr","Arr","Str","Rec","resolvedConfig"],"sources":["../src/entities/workspace/model/config-literal.ts","../src/entities/workspace/model/workspace-config-source.ts","../src/entities/workspace/model/workspace-tasks.ts","../src/entities/workspace/model/workspace-manifest.ts","../src/entities/workspace/model/workspace-projects.ts","../src/entities/workspace/model/workspace-patterns.ts","../src/entities/workspace/model/shadcn-ui.ts","../src/entities/workspace/model/deploy-entries.ts","../src/entities/workspace/model/locked-links.ts","../src/shared/lib/frontmatter.ts","../src/shared/lib/index-skill.ts","../src/entities/workspace/model/mod-directories.ts","../src/entities/package/model/public-entries.ts","../src/entities/package/model/published.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Predicate, Record as Rec, Schema, pipe } from \"effect\";\nimport type { ESTree } from \"vite-plus/lint/plugins\";\n\nexport type Literal = string | number | boolean | null | readonly Literal[] | LiteralObject;\n\nexport interface LiteralObject {\n readonly [key: string]: Literal;\n}\n\nconst WRAPPERS = [\"TSAsExpression\", \"TSSatisfiesExpression\", \"ParenthesizedExpression\"] as const;\n\nexport const KeySchema = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"Literal\"), value: Schema.String }),\n]);\nconst Quasi = Schema.Struct({ value: Schema.Struct({ cooked: Schema.String }) });\nconst PropertyNode = Schema.Struct({\n type: Schema.Literal(\"Property\"),\n computed: Schema.Literal(false),\n key: KeySchema,\n value: Schema.Unknown,\n});\nconst WrappedNode = Schema.Struct({ type: Schema.Literals(WRAPPERS), expression: Schema.Unknown });\nconst ValueNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"Literal\"),\n value: Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]),\n }),\n Schema.Struct({\n type: Schema.Literal(\"TemplateLiteral\"),\n expressions: Schema.Tuple([]),\n quasis: Schema.Array(Quasi),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ArrayExpression\"),\n elements: Schema.Array(Schema.Unknown),\n }),\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(PropertyNode),\n }),\n]);\n\nconst decodeWrapped = Schema.decodeUnknownOption(WrappedNode);\nconst decodeValue = Schema.decodeUnknownOption(ValueNode);\nconst decodeProperty = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"Property\"), key: KeySchema, value: Schema.Unknown }),\n);\nconst decodeObject = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ObjectExpression\"),\n properties: Schema.Array(Schema.Unknown),\n }),\n);\n\nexport const keyName = (key: typeof KeySchema.Type): string =>\n Match.value(key).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Identifier: (identifier) => identifier.name,\n Literal: (literal) => literal.value,\n }),\n );\n\nexport const literalOf = (node: unknown): Option.Option<Literal> => {\n const wrapped = decodeWrapped(node);\n if (Option.isSome(wrapped)) {\n return literalOf(wrapped.value.expression);\n }\n return pipe(\n decodeValue(node),\n Option.flatMap((value) =>\n Match.value(value).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n Literal: (scalar): Option.Option<Literal> => Option.some(scalar.value),\n TemplateLiteral: (template): Option.Option<Literal> =>\n Option.some(\n pipe(\n template.quasis,\n Arr.map((quasi) => quasi.value.cooked),\n Arr.join(\"\"),\n ),\n ),\n ArrayExpression: (array): Option.Option<Literal> =>\n pipe(array.elements, Arr.map(literalOf), Option.all),\n ObjectExpression: (object): Option.Option<Literal> =>\n pipe(\n object.properties,\n Arr.map((property) =>\n pipe(\n literalOf(property.value),\n Option.map((literal) => [keyName(property.key), literal] as const),\n ),\n ),\n Option.all,\n Option.map(Rec.fromEntries),\n ),\n }),\n ),\n ),\n );\n};\n\nexport const propertyValue =\n (name: string) =>\n (object: unknown): Option.Option<unknown> =>\n pipe(\n decodeObject(object),\n Option.flatMap(({ properties }) =>\n pipe(\n properties,\n Arr.findFirst((property) =>\n pipe(\n decodeProperty(property),\n Option.filter(({ key }) => keyName(key) === name),\n Option.map(({ value }) => value),\n ),\n ),\n ),\n ),\n );\n\nexport const childrenOf = (node: unknown): readonly unknown[] => {\n if (Arr.isArray(node)) {\n return node;\n }\n if (Predicate.isReadonlyObject(node)) {\n return Rec.values(node);\n }\n return [];\n};\n\nexport const keyValues =\n (name: string) =>\n (node: unknown): readonly unknown[] => [\n ...Option.toArray(propertyValue(name)(node)),\n ...pipe(childrenOf(node), Arr.flatMap(keyValues(name))),\n ];\n\nexport const nestedValues =\n (path: readonly [string, string]) =>\n (node: unknown): readonly unknown[] => {\n const [outer, inner] = path;\n const own = pipe(\n Option.some(node),\n Option.flatMap(propertyValue(outer)),\n Option.flatMap(propertyValue(inner)),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(nestedValues(path)))];\n };\n\nconst StringNode = Schema.Union([\n Schema.Struct({\n type: Schema.Literal<ESTree.StringLiteral[\"type\"]>(\"Literal\"),\n value: Schema.String,\n start: Schema.Finite,\n }),\n Schema.Struct({\n type: Schema.Literal<ESTree.TemplateElement[\"type\"]>(\"TemplateElement\"),\n value: Schema.Struct({ cooked: Schema.String }),\n start: Schema.Finite,\n }),\n]);\nconst decodeStringNode = Schema.decodeUnknownOption(StringNode);\n\nexport interface FoundString {\n readonly text: string;\n readonly start: number;\n}\n\nconst textOf = (node: typeof StringNode.Type): string => {\n if (node.type === \"Literal\") {\n return node.value;\n }\n return node.value.cooked;\n};\n\nexport const stringsIn = (node: unknown): readonly FoundString[] => {\n const own = pipe(\n decodeStringNode(node),\n Option.map((found) => ({ text: textOf(found), start: found.start })),\n Option.toArray,\n );\n return [...own, ...pipe(childrenOf(node), Arr.flatMap(stringsIn))];\n};\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { literalOf, nestedValues } from \"./config-literal.ts\";\n\nconst SINGLE = 1;\nconst CONFIG_FILE = \"vite.config.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceSettingsInvalid extends taggedError<\n WorkspaceSettingsInvalid,\n { readonly brand: unique symbol }\n>()(\"WorkspaceSettingsInvalid\", { file: Schema.String, message: Schema.String }) {}\n\nexport const settingsInvalid =\n (file: string) =>\n (reason: string): WorkspaceSettingsInvalid =>\n WorkspaceSettingsInvalid.make({ file, message: `${file}: ${reason}` });\n\nexport interface WorkspaceSource {\n readonly file: string;\n readonly directory: string;\n readonly program: unknown;\n}\n\nexport type SettingsPath = readonly [string, string];\n\nconst notLiteral = ([outer, inner]: SettingsPath): string =>\n `${outer}.${inner} must be written with literal values, because the root vite.config.ts reads it without running this file. Write the values in place instead of importing them.`;\n\nexport const merged = <Value>(\n records: readonly Readonly<Record<string, Value>>[],\n): Record<string, Value> => pipe(records, Arr.flatMap(Rec.toEntries), Rec.fromEntries);\n\nexport const usedFrom = Effect.fn(\"usedFrom\")(function* usedFrom<Value>(\n file: string,\n sets: Readonly<Record<string, Value>>,\n used: readonly string[],\n) {\n const unknownSets = pipe(\n used,\n Arr.filter((name) => !Rec.has(sets, name)),\n );\n if (Arr.isReadonlyArrayNonEmpty(unknownSets)) {\n return yield* settingsInvalid(file)(\n `msch has no set named ${Arr.join(unknownSets, \", \")}. Sets msch has: ${Arr.join(Rec.keys(sets), \", \")}.`,\n );\n }\n return pipe(\n used,\n Arr.flatMap((name) => Option.toArray(Rec.get(sets, name))),\n );\n});\n\nconst singleValue = Effect.fn(\"singleValue\")(function* singleValue(\n source: WorkspaceSource,\n path: SettingsPath,\n) {\n const found = nestedValues(path)(source.program);\n if (found.length > SINGLE) {\n return yield* settingsInvalid(source.file)(`${Arr.join(path, \".\")} appears more than once.`);\n }\n return Arr.head(found);\n});\n\nexport interface LiteralSettingsRequest<Settings> {\n readonly source: WorkspaceSource;\n readonly path: SettingsPath;\n readonly decode: (input: unknown) => Effect.Effect<Settings, Schema.SchemaError>;\n}\n\nexport const literalSettings = <Settings>({\n source,\n path,\n decode,\n}: LiteralSettingsRequest<Settings>): Effect.Effect<\n Option.Option<Settings>,\n WorkspaceSettingsInvalid\n> =>\n Effect.gen(function* literalSettingsIn() {\n const node = yield* singleValue(source, path);\n if (Option.isNone(node)) {\n return Option.none();\n }\n const literal = literalOf(node.value);\n if (Option.isNone(literal)) {\n return yield* settingsInvalid(source.file)(notLiteral(path));\n }\n const settings = yield* decode(literal.value).pipe(\n Effect.mapError((error) => settingsInvalid(source.file)(error.message)),\n );\n return Option.some(settings);\n });\n\nexport const programOf = Effect.fn(\"programOf\")(function* programOf(file: string, text: string) {\n const parsed = yield* Effect.promise(() => parse(file, text, { lang: \"ts\" }));\n if (Arr.isReadonlyArrayNonEmpty(parsed.errors)) {\n return yield* settingsInvalid(file)(\"vite.config.ts does not parse.\");\n }\n const program: unknown = parsed.program;\n return program;\n});\n\n/** @internal */\nexport interface WorkspaceConfig {\n readonly file: string;\n readonly source: string;\n readonly program: unknown;\n}\n\nexport const workspaceConfigOf = Effect.fn(\"workspaceConfigOf\")(function* workspaceConfigOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, CONFIG_FILE);\n const text = yield* files.readFile(file);\n if (Option.isNone(text)) {\n return Option.none<WorkspaceConfig>();\n }\n const program = yield* programOf(file, text.value);\n return Option.some<WorkspaceConfig>({ file, source: text.value, program });\n});\n\nexport type { WorkspaceSettingsInvalid };\n","import type { PackageJson } from \"@r_masseater/masseater-utils/kestrion\";\nimport { resolvedViteConfig as sharedConfig } from \"@r_masseater/masseater-utils/vite-config\";\nimport { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\n\nimport { nestedValues, propertyValue, stringsIn } from \"./config-literal.ts\";\nimport type { FoundString } from \"./config-literal.ts\";\nimport { settingsInvalid } from \"./workspace-config-source.ts\";\n\nexport const TASK_NAMES = { verify: \"verify\", test: \"test\", cargoTest: \"cargo-test\" } as const;\n\nexport const TEST_TASK_NAMES: readonly string[] = [TASK_NAMES.test, TASK_NAMES.cargoTest];\n\nexport const VERIFY_TASK = [\"tasks\", TASK_NAMES.verify] as const;\n\nexport const TEST_TASK = [\"tasks\", TASK_NAMES.test] as const;\n\nconst CARGO_TEST_TASK = [\"tasks\", TASK_NAMES.cargoTest] as const;\n\nconst NATIVE_TASK = [\"tasks\", \"native\"] as const;\n\nexport const RUN_TASKS = [\"run\", \"tasks\"] as const;\n\nexport interface WorkspaceTasks {\n readonly verify: readonly string[];\n readonly test: readonly string[];\n readonly native: readonly string[];\n}\n\nexport const NO_TASKS: WorkspaceTasks = { verify: [], test: [], native: [] };\n\nconst Tasks = Schema.Struct({ verify: Schema.Unknown });\nconst isVerified = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: Tasks }) }));\n\nexport const definesTask =\n (path: readonly [string, string]) =>\n (program: unknown): boolean =>\n Arr.isReadonlyArrayNonEmpty(nestedValues(path)(program));\n\nconst DEPENDS_ON = \"dependsOn\";\n\nconst testsInVerify = (program: unknown): readonly FoundString[] =>\n pipe(\n nestedValues(VERIFY_TASK)(program),\n Arr.flatMap((verify) => Option.toArray(propertyValue(DEPENDS_ON)(verify))),\n Arr.flatMap(stringsIn),\n Arr.filter(({ text }) => text === TASK_NAMES.test),\n );\n\nexport const testsItself = (program: unknown): boolean =>\n definesTask(TEST_TASK)(program) || Arr.isReadonlyArrayNonEmpty(testsInVerify(program));\n\nconst CargoTasks = Schema.Struct({ cargo: Schema.Unknown });\nconst checksCargo = Schema.is(Schema.Struct({ run: Schema.Struct({ tasks: CargoTasks }) }));\n\nconst resolvedConfig = (file: string): Effect.Effect<Option.Option<unknown>> =>\n Effect.tryPromise({\n try: () => sharedConfig(file),\n catch: () => settingsInvalid(file)(\"vite.config.ts does not load.\"),\n }).pipe(Effect.option);\n\nexport const hasVerifyTask = Effect.fn(\"hasVerifyTask\")(function* hasVerifyTask(file: string) {\n const config = yield* resolvedConfig(file);\n return Option.exists(config, isVerified);\n});\n\nexport const hasCargoTask = Effect.fn(\"hasCargoTask\")(function* hasCargoTask(file: string) {\n const config = yield* resolvedConfig(file);\n return Option.exists(config, checksCargo);\n});\n\nconst shipsAddon = (manifest: Option.Option<PackageJson>): boolean =>\n Option.exists(manifest, (found) => Predicate.isNotUndefined(found.native));\n\nexport const tasksOf =\n (manifest: Option.Option<PackageJson>) =>\n (program: unknown): WorkspaceTasks =>\n pipe(\n manifest,\n Option.flatMap((found) => Option.fromUndefinedOr(found.name)),\n Option.match({\n onNone: () => NO_TASKS,\n onSome: (name) => ({\n verify: Arr.filter([`${name}#verify`], () => definesTask(VERIFY_TASK)(program)),\n test: Arr.getSomes([\n Option.liftPredicate(`${name}#test`, () => definesTask(TEST_TASK)(program)),\n Option.liftPredicate(`${name}#cargo-test`, () => definesTask(CARGO_TEST_TASK)(program)),\n ]),\n native: Arr.filter(\n [`${name}#native`],\n () => definesTask(NATIVE_TASK)(program) || shipsAddon(manifest),\n ),\n }),\n }),\n );\n","import { readWorkspaceManifest } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport type { WorkspaceManifest } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport { Effect, Option } from \"effect\";\n\n/** @internal */\nexport const workspaceManifest = (root: string): Effect.Effect<Option.Option<WorkspaceManifest>> =>\n readWorkspaceManifest(root).pipe(Effect.orElseSucceed(() => Option.none()));\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { findWorkspaceProjects } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport type { Project } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport { Array as Arr, Effect, Option, Order, Predicate, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { workspaceManifest } from \"./workspace-manifest.ts\";\n\nconst ROOT_DIRECTORY = \"\";\n\nexport interface WorkspaceProject {\n readonly directory: string;\n readonly packageName: Option.Option<string>;\n readonly description: Option.Option<string>;\n readonly published: boolean;\n readonly keywords: readonly string[];\n readonly files: Option.Option<readonly string[]>;\n}\n\nconst byDirectory = Order.mapInput(Str.Order, ({ directory }: WorkspaceProject) => directory);\n\nconst projectsMatching = (\n root: string,\n patterns: readonly string[],\n): Effect.Effect<readonly Project[]> =>\n findWorkspaceProjects(root, patterns).pipe(Effect.orElseSucceed((): readonly Project[] => []));\n\nconst workspacePatterns = Effect.fn(\"workspacePatterns\")(function* workspacePatterns(root: string) {\n const manifest = yield* workspaceManifest(root);\n return pipe(\n manifest,\n Option.flatMap(({ packages }) => Option.fromNullishOr(packages)),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\n/** @internal */\nexport const workspaceProjects = Effect.fn(\"workspaceProjects\")(function* workspaceProjects(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const patterns = yield* workspacePatterns(root);\n if (!Arr.isReadonlyArrayNonEmpty(patterns)) {\n return [];\n }\n const projects = yield* projectsMatching(root, patterns);\n const found = pipe(\n projects,\n Arr.map(({ rootDir, manifest: own }): WorkspaceProject => ({\n directory: files.relative(root, rootDir),\n packageName: Option.fromUndefinedOr(own.name),\n description: Option.filter(Option.fromUndefinedOr(own.description), Str.isNonEmpty),\n published: own.private !== true,\n keywords: Option.getOrElse(Option.fromUndefinedOr(own.keywords), () => []),\n files: Option.fromUndefinedOr(own.files),\n })),\n Arr.filter(({ directory }) => Str.isNonEmpty(directory)),\n );\n return Arr.sort(found, byDirectory);\n});\n\n/** @internal */\nexport const workspaceDirectories = Effect.fn(\"workspaceDirectories\")(\n function* workspaceDirectories(root: string) {\n const projects = yield* workspaceProjects(root);\n return pipe(\n projects,\n Arr.map(({ directory }) => directory),\n );\n },\n);\n\nconst rootProject = Effect.fn(\"rootProject\")(function* rootProject(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, PACKAGE_JSON_FILE));\n return pipe(\n text,\n Option.flatMap(decodePackageJson),\n Option.filter((own) => Predicate.isNotUndefined(own.name)),\n Option.map((own): WorkspaceProject => ({\n directory: ROOT_DIRECTORY,\n packageName: Option.fromUndefinedOr(own.name),\n description: Option.filter(Option.fromUndefinedOr(own.description), Str.isNonEmpty),\n published: own.private !== true,\n keywords: own.keywords ?? [],\n files: Option.fromUndefinedOr(own.files),\n })),\n );\n});\n\n/** @internal */\nexport const publishedProjects = Effect.fn(\"publishedProjects\")(function* publishedProjects(\n root: string,\n) {\n const [own, members] = yield* Effect.all([rootProject(root), workspaceProjects(root)], {\n concurrency: \"unbounded\",\n });\n return pipe(\n Option.toArray(own),\n Arr.appendAll(members),\n Arr.filter(({ published }) => published),\n );\n});\n\nconst NEGATION = \"!\";\nconst MATCH_CONCURRENCY = 8;\n\n/** @internal */\nexport const unmatchedWorkspacePatterns = Effect.fn(\"unmatchedWorkspacePatterns\")(\n function* unmatchedWorkspacePatterns(root: string) {\n const listed = yield* workspacePatterns(root);\n const patterns = pipe(\n listed,\n Arr.filter((pattern) => !Str.startsWith(NEGATION)(pattern)),\n );\n const matched = yield* Effect.forEach(\n patterns,\n (pattern) =>\n projectsMatching(root, [pattern]).pipe(\n Effect.map((projects) => ({ pattern, matches: Arr.isReadonlyArrayNonEmpty(projects) })),\n ),\n { concurrency: MATCH_CONCURRENCY },\n );\n return pipe(\n matched,\n Arr.filter(({ matches }) => !matches),\n Arr.map(({ pattern }) => pattern),\n );\n },\n);\n","import { String as Str } from \"effect\";\n\nconst SEPARATOR = \"/\";\nconst NEGATION = \"!\";\nconst RELATIVE = \"./\";\n\nexport const withoutRelative = (target: string): string => {\n if (Str.startsWith(RELATIVE)(target)) {\n return Str.slice(RELATIVE.length)(target);\n }\n return target;\n};\n\nexport const prefixed =\n (directory: string) =>\n (pattern: string): string => {\n if (Str.startsWith(NEGATION)(pattern)) {\n return `${NEGATION}${directory}${SEPARATOR}${Str.slice(NEGATION.length)(pattern)}`;\n }\n return `${directory}${SEPARATOR}${withoutRelative(pattern)}`;\n };\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { prefixed, withoutRelative } from \"./workspace-patterns.ts\";\n\nconst SHADCN_FILE = \"components.json\";\nconst WILDCARD = \"*\";\nconst EVERYTHING = \"/**\";\n\nconst ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });\nconst decodeImports = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.String));\nconst decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));\n\nconst withoutWildcard = Str.replace(WILDCARD, \"\");\n\nconst importTarget =\n (alias: string) =>\n ([key, target]: readonly [string, string]): Option.Option<string> => {\n if (!Str.endsWith(WILDCARD)(key)) {\n return Option.some(target).pipe(Option.filter(() => key === alias));\n }\n const prefix = withoutWildcard(key);\n if (!Str.startsWith(prefix)(alias)) {\n return Option.none();\n }\n return Option.some(`${withoutWildcard(target)}${Str.slice(prefix.length)(alias)}`);\n };\n\nconst resolvedAlias = (\n imports: Readonly<Record<string, string>>,\n alias: string,\n): Option.Option<string> =>\n pipe(Rec.toEntries(imports), Arr.findFirst(importTarget(alias)), Option.map(withoutRelative));\n\nexport type ShadcnUi = Readonly<{\n file: string;\n alias: string;\n target: Option.Option<string>;\n}>;\n\nexport const shadcnUiOf = Effect.fn(\"shadcnUiOf\")(function* shadcnUiOf(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, directory, SHADCN_FILE);\n const configText = yield* files.readFile(file);\n const manifestText = yield* files.readFile(files.join(root, directory, PACKAGE_JSON_FILE));\n const imports = pipe(\n manifestText,\n Option.flatMap(decodePackageJson),\n Option.flatMap((manifest) => decodeImports(manifest.imports)),\n );\n return pipe(\n configText,\n Option.flatMap(decodeShadcnConfig),\n Option.map(({ aliases }): ShadcnUi => ({\n file,\n alias: aliases.ui,\n target: pipe(\n imports,\n Option.flatMap((map) => resolvedAlias(map, aliases.ui)),\n ),\n })),\n );\n});\n\nexport const shadcnUiIn = Effect.fn(\"shadcnUiIn\")(function* shadcnUiIn(\n root: string,\n directory: string,\n) {\n const found = yield* shadcnUiOf(root, directory);\n return pipe(\n found,\n Option.map(\n ({ alias, target }) =>\n `${target.pipe(\n Option.getOrElse(() => alias),\n prefixed(directory),\n )}${EVERYTHING}`,\n ),\n );\n});\n","import { Array as Arr, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { parse } from \"vite-plus\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { KeySchema, childrenOf, keyName, stringsIn } from \"./config-literal.ts\";\n\nconst MAIN_KEY = \"main\";\nconst FRAMEWORK_SITES = \"Website\";\nconst READ_CONCURRENCY = 16;\nconst SCRIPT = /\\.[cm]?tsx?$/u;\nconst SKIPPED = /\\.test\\.|\\.d\\.[cm]?ts$/u;\nconst ALCHEMY_IMPORT = /from\\s+[\"'](?:alchemy|@alchemy\\.run)(?:\\/[^\"']*)?[\"']/u;\nconst MAIN_PROPERTY = /\\bmain\\s*:/u;\nconst decodeKey = Schema.decodeUnknownOption(KeySchema);\nconst SiteNamespace = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(FRAMEWORK_SITES),\n});\nconst SiteResource = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n object: SiteNamespace,\n});\nconst FrameworkSite = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: SiteResource,\n});\nconst decodeFrameworkSite = Schema.decodeUnknownOption(FrameworkSite);\n\nconst isMainProperty = (node: Readonly<Record<string, unknown>>): boolean =>\n node[\"type\"] === \"Property\" &&\n pipe(\n decodeKey(node[\"key\"]),\n Option.exists((key) => keyName(key) === MAIN_KEY),\n );\n\ntype Skip = (node: unknown) => boolean;\n\nconst skipNothing: Skip = () => false;\n\nconst isFrameworkSite: Skip = (node) => Option.isSome(decodeFrameworkSite(node));\n\nconst mainTargetsIn = (skip: Skip): ((node: unknown) => readonly string[]) => {\n const visit = (node: unknown): readonly string[] => {\n if (skip(node)) {\n return [];\n }\n if (Predicate.isReadonlyObject(node) && isMainProperty(node)) {\n return pipe(\n stringsIn(node[\"value\"]),\n Arr.head,\n Option.map(({ text }) => text),\n Option.toArray,\n );\n }\n return pipe(childrenOf(node), Arr.flatMap(visit));\n };\n return visit;\n};\n\ninterface Declaring {\n readonly root: string;\n readonly file: string;\n readonly skip: Skip;\n}\n\nconst declaredIn = Effect.fn(\"declaredIn\")(function* declaredIn({ root, file, skip }: Declaring) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, file));\n if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value) || !MAIN_PROPERTY.test(text.value)) {\n return [];\n }\n const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: \"ts\" }));\n return pipe(\n mainTargetsIn(skip)(parsed.program),\n Arr.map((target) => files.join(files.dirname(file), target)),\n );\n});\n\nconst entriesOutside = Effect.fn(\"entriesOutside\")(function* entriesOutside(\n root: string,\n skip: Skip,\n) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const declaring = pipe(\n listed,\n Arr.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)),\n );\n const found = yield* Effect.forEach(declaring, (file) => declaredIn({ root, file, skip }), {\n concurrency: READ_CONCURRENCY,\n });\n return pipe(\n Arr.flatten(found),\n Arr.filter((file) => Arr.contains(listed, file)),\n Arr.dedupe,\n );\n});\n\nexport const deployEntries = Effect.fn(\"deployEntries\")(function* deployEntries(root: string) {\n return yield* entriesOutside(root, skipNothing);\n});\n\nexport const bundledEntries = Effect.fn(\"bundledEntries\")(function* bundledEntries(root: string) {\n return yield* entriesOutside(root, isFrameworkSite);\n});\n","import { readWantedLockfile } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport type { ResolvedDependencies } from \"@r_masseater/masseater-utils/kestrion/pnpm\";\nimport { Array as Arr, Effect, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst LINK = \"link:\";\n\nexport interface WorkspaceLink {\n readonly from: string;\n readonly to: string;\n}\n\nexport const linkedPaths = (\n sections: readonly (ResolvedDependencies | undefined)[],\n): readonly string[] =>\n pipe(\n sections,\n Arr.flatMap((resolved) => Rec.values(resolved ?? {})),\n Arr.filter(Str.startsWith(LINK)),\n Arr.map((reference) => Str.slice(LINK.length)(reference)),\n );\n\n/** @internal */\nexport const workspaceLinks = Effect.fn(\"workspaceLinks\")(function* workspaceLinks(root: string) {\n const files = yield* RepositoryFiles;\n const lockfile = yield* readWantedLockfile(root);\n const linksOf = (id: string, paths: readonly string[]): readonly WorkspaceLink[] => {\n const from = files.relative(root, files.join(root, id));\n return pipe(\n paths,\n Arr.map((path): WorkspaceLink => ({\n from,\n to: files.relative(root, files.join(root, id, path)),\n })),\n );\n };\n return pipe(\n lockfile,\n Option.map(({ importers }) =>\n pipe(\n Rec.toEntries(importers),\n Arr.flatMap(([id, project]) =>\n linksOf(\n id,\n linkedPaths([\n project.dependencies,\n project.devDependencies,\n project.optionalDependencies,\n ]),\n ),\n ),\n ),\n ),\n Option.getOrElse((): readonly WorkspaceLink[] => []),\n );\n});\n","import { groupOf } from \"@r_masseater/masseater-utils/text\";\nimport { Option, Schema, String as Str, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nexport const FRONTMATTER = /^---\\n(?<yaml>[\\s\\S]*?)\\n---\\n/u;\n\nconst START = 0;\nconst Fields = Schema.Record(Schema.String, Schema.Unknown);\nconst decodeFields = Schema.decodeUnknownOption(Fields);\n\nexport interface Frontmatter {\n readonly fields: typeof Fields.Type;\n readonly body: string;\n}\n\nexport const splitFrontmatter = (source: string): Option.Option<Frontmatter> =>\n pipe(\n Option.fromNullishOr(FRONTMATTER.exec(source)),\n Option.flatMap((found) =>\n pipe(\n groupOf(\"yaml\")(found),\n Option.flatMap(Option.liftThrowable((yaml: string): unknown => parse(yaml))),\n Option.flatMap(decodeFields),\n Option.map((fields): Frontmatter => ({\n fields,\n body: Str.slice(found[START].length)(source),\n })),\n ),\n ),\n );\n","/** @internal */\nexport const INDEX_SKILL = /(?:^|\\/)plugins\\/(?<plugin>[^/]+)\\/skills\\/\\k<plugin>\\/SKILL\\.md$/u;\n","import { Array as Arr, Effect, Option, Schema, String as Str, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst HOOKS_FILE = \"hooks/hooks.json\";\nconst Modules = Schema.String.pipe(Schema.Array, Schema.optional);\nconst HooksFile = Schema.fromJsonString(Schema.Struct({ modules: Modules }));\nconst decodeHooks = Schema.decodeUnknownOption(HooksFile);\nconst PARENT = 1;\n\nconst directoryOf = (module: string): string => {\n const parts = pipe(\n Str.split(`hooks/${module}`, \"/\"),\n Arr.filter((part) => part !== \"\" && part !== \".\"),\n );\n return `${Arr.join(Arr.dropRight(parts, PARENT), \"/\")}/`;\n};\n\n/** @internal */\nexport const modDirectoriesOf = (hooks: string): readonly string[] =>\n pipe(\n decodeHooks(hooks),\n Option.flatMap(({ modules }) => Option.fromNullishOr(modules)),\n Option.getOrElse((): readonly string[] => []),\n Arr.map(directoryOf),\n Arr.dedupe,\n );\n\n/** @internal */\nexport const modDirectories = Effect.fn(\"modDirectories\")(function* modDirectories(\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const hooks = yield* files.readFile(files.join(directory, HOOKS_FILE));\n return Option.match(hooks, { onNone: (): readonly string[] => [], onSome: modDirectoriesOf });\n});\n","import { binEntriesOf, exportEntriesOf, targetsIn } from \"@r_masseater/masseater-utils/kestrion\";\nimport type { PackageJson } from \"@r_masseater/masseater-utils/kestrion\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { PackEntrySource } from \"./published.ts\";\n\nconst SOURCE = /\\.[cm]?tsx?$/u;\nconst BUILT = /\\.(?:d\\.)?[cm]?[jt]s$/u;\nconst OUT_DIRECTORY = /^(?:\\.\\/)?[^/]+\\//u;\nconst DECLARATION = \".d.\";\nconst BIN_LABEL = \"bin\";\n\nexport interface PublicEntry {\n readonly label: string;\n readonly source: string;\n}\n\nexport type EntryManifest = Pick<PackageJson, \"name\" | \"exports\" | \"bin\">;\n\nexport interface EntryLookup {\n readonly manifest: EntryManifest;\n readonly join: (target: string) => string;\n readonly packEntries: readonly PackEntrySource[];\n}\n\nexport const isBinEntry = ({ label }: PublicEntry): boolean =>\n Str.startsWith(`${BIN_LABEL} `)(label);\n\nconst binsOf = (manifest: EntryManifest): readonly (readonly [string, unknown])[] =>\n pipe(\n binEntriesOf(manifest),\n Arr.map(([name, target]) => [`${BIN_LABEL} ${name}`, target] as const),\n );\n\nexport const entryNameOf = (target: string): string =>\n pipe(target, Str.replace(OUT_DIRECTORY, \"\"), Str.replace(BUILT, \"\"));\n\nconst sourceOf =\n ({ join, packEntries }: EntryLookup) =>\n (target: string): Option.Option<string> => {\n if (SOURCE.test(target) && !Str.includes(DECLARATION)(target)) {\n return Option.some(join(target));\n }\n const name = entryNameOf(target);\n return pipe(\n packEntries,\n Arr.findFirst((entry) => entry.name === name),\n Option.map((entry) => entry.source),\n );\n };\n\nexport const publicEntriesOf = (lookup: EntryLookup): readonly PublicEntry[] =>\n pipe(\n [...exportEntriesOf(lookup.manifest.exports), ...binsOf(lookup.manifest)],\n Arr.flatMap(([label, held]) =>\n pipe(\n targetsIn(held),\n Arr.map(sourceOf(lookup)),\n Arr.getSomes,\n Arr.map((source) => ({ label, source })),\n ),\n ),\n Arr.dedupeWith((left, right) => left.label === right.label && left.source === right.source),\n );\n","import { PACKAGE_JSON_FILE } from \"@r_masseater/masseater-utils/kestrion\";\nimport { decodePackageJson } from \"@r_masseater/masseater-utils/kestrion/npm\";\nimport { resolvedViteConfig as resolvedConfig } from \"@r_masseater/masseater-utils/vite-config\";\nimport {\n Array as Arr,\n Effect,\n Option,\n Predicate,\n Record as Rec,\n Schema,\n String as Str,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst CONFIG_FILE = \"vite.config.ts\";\nconst SEPARATOR = \"/\";\nconst READ_CONCURRENCY = 16;\nconst SOURCE_EXTENSION = /\\.[cm]?tsx?$/u;\nconst BYTE = 1;\nconst KILOBYTE = 1000;\nconst MEGABYTE = 1_000_000;\nconst UNIT_BYTES = [\n [\"B\", BYTE],\n [\"kB\", KILOBYTE],\n [\"MB\", MEGABYTE],\n] as const;\n\nconst SizeText = Schema.TemplateLiteralParser([\n Schema.Finite,\n \" \",\n Schema.Literals([\"B\", \"kB\", \"MB\"]),\n]);\nexport const PackEntry = Schema.Union([\n Schema.String,\n Schema.Array(Schema.String),\n Schema.Record(Schema.String, Schema.String),\n]);\nconst BundledPattern = Schema.Union([Schema.String, Schema.instanceOf(RegExp)]);\nconst AlwaysBundle = Schema.Union([BundledPattern, Schema.Array(BundledPattern)]);\nconst PackDeps = Schema.Struct({ alwaysBundle: Schema.optional(AlwaysBundle) });\nconst PackSettings = Schema.Struct({\n entry: Schema.optional(PackEntry),\n deps: Schema.optional(PackDeps),\n});\nconst PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);\nconst isEntryList = Schema.is(Schema.Array(Schema.String));\nconst PackConfig = Schema.Struct({ pack: Schema.optional(PackList) });\nconst BudgetConfig = Schema.Struct({\n msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),\n});\n\nconst taggedError = Schema.TaggedError;\n\nclass WorkspaceConfigUnreadable extends taggedError<\n WorkspaceConfigUnreadable,\n { readonly brand: unique symbol }\n>()(\"WorkspaceConfigUnreadable\", { file: Schema.String }) {}\n\nexport interface PackEntrySource {\n readonly name: string;\n readonly source: string;\n}\n\nexport interface PackedWorkspace {\n readonly directory: string;\n readonly configFile: string;\n readonly packEntries: readonly PackEntrySource[];\n readonly alwaysBundle: readonly (string | RegExp)[];\n}\n\nexport interface PublishedWorkspace extends PackedWorkspace {\n readonly installSize: string;\n readonly installBudget: number;\n}\n\nconst bytesPer = (unit: string): number =>\n pipe(\n UNIT_BYTES,\n Arr.findFirst(([name]) => name === unit),\n Option.map(([, bytes]) => bytes),\n Option.getOrElse(() => Number.NaN),\n );\n\nconst nameOf = (source: string): string =>\n pipe(\n Str.split(source, SEPARATOR),\n Arr.last,\n Option.getOrElse(() => source),\n Str.replace(SOURCE_EXTENSION, \"\"),\n );\n\nexport const entriesOf = (entry: typeof PackEntry.Type): readonly PackEntrySource[] => {\n if (Predicate.isString(entry)) {\n return [{ name: nameOf(entry), source: entry }];\n }\n if (isEntryList(entry)) {\n return pipe(\n entry,\n Arr.map((source) => ({ name: nameOf(source), source })),\n );\n }\n return pipe(\n Rec.toEntries(entry),\n Arr.map(([name, source]) => ({ name, source })),\n );\n};\n\nconst packSettingsOf = (pack: typeof PackConfig.Type.pack): readonly (typeof PackSettings.Type)[] =>\n pipe(\n Option.fromUndefinedOr(pack),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (typeof PackSettings.Type)[] => []),\n );\n\nconst packEntriesOf = (pack: typeof PackConfig.Type.pack): readonly PackEntrySource[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.entry),\n Option.match({ onNone: () => [], onSome: entriesOf }),\n ),\n ),\n );\n\nconst alwaysBundleOf = (pack: typeof PackConfig.Type.pack): readonly (string | RegExp)[] =>\n pipe(\n packSettingsOf(pack),\n Arr.flatMap((setting) =>\n pipe(\n Option.fromUndefinedOr(setting.deps),\n Option.flatMap((deps) => Option.fromUndefinedOr(deps.alwaysBundle)),\n Option.map(Arr.ensure),\n Option.getOrElse((): readonly (string | RegExp)[] => []),\n ),\n ),\n Arr.dedupe,\n );\n\nconst settingsIn = Effect.fn(\"settingsIn\")(function* settingsIn(file: string) {\n const config = yield* Effect.tryPromise({\n try: () => resolvedConfig(file),\n catch: () => WorkspaceConfigUnreadable.make({ file }),\n }).pipe(Effect.option);\n return config;\n});\n\nconst isPublicPackage = Effect.fn(\"isPublicPackage\")(function* isPublicPackage(directory: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));\n return pipe(\n text,\n Option.flatMap(decodePackageJson),\n Option.exists((manifest) => manifest.private !== true),\n );\n});\n\nconst packedWorkspaceOf =\n (directory: string, configFile: string, join: (source: string) => string) =>\n ({ pack }: typeof PackConfig.Type): PackedWorkspace => ({\n directory,\n configFile,\n packEntries: pipe(\n packEntriesOf(pack),\n Arr.map((entry) => ({ name: entry.name, source: join(entry.source) })),\n ),\n alwaysBundle: alwaysBundleOf(pack),\n });\n\nconst budgetOf = ({\n msch,\n}: typeof BudgetConfig.Type): Pick<PublishedWorkspace, \"installSize\" | \"installBudget\"> => {\n const [amount, , unit] = msch.publish.installSize;\n return { installSize: `${amount} ${unit}`, installBudget: amount * bytesPer(unit) };\n};\n\nconst packedIn = Effect.fn(\"packedIn\")(function* packedIn(root: string, configName: string) {\n const files = yield* RepositoryFiles;\n const configFile = files.join(root, configName);\n const directory = files.dirname(configFile);\n const isPublic = yield* isPublicPackage(directory);\n if (!isPublic) {\n return Option.none<readonly [PackedWorkspace, unknown]>();\n }\n const config = yield* settingsIn(configFile);\n return pipe(\n config,\n Option.flatMap((found) =>\n pipe(\n Schema.decodeUnknownOption(PackConfig)(found),\n Option.map(\n packedWorkspaceOf(directory, configFile, (source) => files.join(directory, source)),\n ),\n Option.map((workspace) => [workspace, found] as const),\n ),\n ),\n );\n});\n\n/** @internal */\nexport const workspaceConfigs = Effect.fn(\"workspaceConfigs\")(function* workspaceConfigs(\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const names = yield* files.listedFiles(root);\n return pipe(\n names,\n Arr.filter((name) => files.basename(name) === CONFIG_FILE && Str.includes(SEPARATOR)(name)),\n );\n});\n\nconst packedPairs = Effect.fn(\"packedPairs\")(function* packedPairs(root: string) {\n const configs = yield* workspaceConfigs(root);\n const found = yield* Effect.forEach(configs, (name) => packedIn(root, name), {\n concurrency: READ_CONCURRENCY,\n });\n return Arr.getSomes(found);\n});\n\n/** @internal */\nexport const packedWorkspaces = Effect.fn(\"packedWorkspaces\")(function* packedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.map(([workspace]) => workspace),\n );\n});\n\n/** @internal */\nexport const publishedWorkspaces = Effect.fn(\"publishedWorkspaces\")(function* publishedWorkspaces(\n root: string,\n) {\n const pairs = yield* packedPairs(root);\n return pipe(\n pairs,\n Arr.flatMap(([workspace, config]) =>\n pipe(\n Schema.decodeUnknownOption(BudgetConfig)(config),\n Option.map((budget): PublishedWorkspace => ({ ...workspace, ...budgetOf(budget) })),\n Option.toArray,\n ),\n ),\n );\n});\n"],"mappings":";;;;;;;;;;AASA,MAAM,WAAW;CAAC;CAAkB;CAAyB;AAAyB;AAEtF,MAAa,YAAY,OAAO,MAAM,CACpC,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,YAAY;CAAG,MAAM,OAAO;AAAO,CAAC,GACzE,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,SAAS;CAAG,OAAO,OAAO;AAAO,CAAC,CACzE,CAAC;AACD,MAAM,QAAQ,OAAO,OAAO,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+1,9 @@
1
1
  import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
2
- import { Array, Context, Effect, FileSystem, Layer, Option, Order, Path, Stream, String, pipe } from "effect";
3
2
  import { CACHE_DIRECTORY_NAME } from "@r_masseater/masseater-utils/plugin-kit";
3
+ import { groupOf } from "@r_masseater/masseater-utils/text";
4
+ import { Array, Context, Effect, FileSystem, Layer, Option, Path, Stream, String, pipe } from "effect";
4
5
  import { Digest } from "effect/crypto";
5
6
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
- Order.mapInput(String.Order, ([key]) => key);
7
- const groupOf = (name) => (found) => pipe(Option.fromNullishOr(found), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups[name])));
8
7
  // src/shared/lib/tool-name.ts
9
8
  const TOOL_NAME = "msch";
10
9
  // src/shared/lib/repository-files.ts
@@ -177,6 +176,6 @@ const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* n
177
176
  basename: (file) => path.basename(file)
178
177
  });
179
178
  })).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));
180
- export { nodeServicesLayer as a, nodeRepositoryFiles as i, NODE_MODULES as n, TOOL_NAME as o, RepositoryFiles as r, groupOf as s, MSCH_CACHE as t };
179
+ export { nodeServicesLayer as a, nodeRepositoryFiles as i, NODE_MODULES as n, TOOL_NAME as o, RepositoryFiles as r, MSCH_CACHE as t };
181
180
 
182
- //# sourceMappingURL=repository-files-C_GzAnYp.mjs.map
181
+ //# sourceMappingURL=repository-files-CX48nfE5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-files-CX48nfE5.mjs","names":["Str","Arr"],"sources":["../src/shared/lib/tool-name.ts","../src/shared/lib/repository-files.ts"],"sourcesContent":["export const TOOL_NAME = \"msch\";\n","import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { CACHE_DIRECTORY_NAME } from \"@r_masseater/masseater-utils/plugin-kit\";\nimport { groupOf } from \"@r_masseater/masseater-utils/text\";\nimport {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Digest } from \"effect/crypto\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { TOOL_NAME } from \"#/shared/lib/tool-name.ts\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\nconst MISSING_SIZE = 0;\nconst MILLISECONDS = 1000;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst OWNED_PATHSPECS = [\":(exclude,attr:linguist-vendored)\", \":(exclude,attr:linguist-generated)\"];\nexport const NODE_MODULES = \"node_modules\";\n\n/** @internal */\nexport const MSCH_CACHE = [NODE_MODULES, CACHE_DIRECTORY_NAME, TOOL_NAME] as const;\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\", `--exclude=${NODE_MODULES}/`];\nconst IGNORED_ARGS = [\"--others\", \"--ignored\", \"--exclude-standard\"];\nconst TRACKED_ARGS = [\"--cached\"];\nconst STAGED_ARGS = [\"--stage\"];\nconst HISTORY_ARGS = [\n \"log\",\n \"--max-count=300\",\n \"--no-merges\",\n \"--format=%n%h %as %s\",\n \"--name-only\",\n];\nconst LINK_ENTRY = /^120000 \\S+ \\d+\\t(?<name>.+)$/u;\n\nexport class RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly readBytes: (file: string) => Effect.Effect<Option.Option<Uint8Array>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly walkDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly writeFile: (file: string, text: string) => Effect.Effect<void>;\n readonly removeFile: (file: string) => Effect.Effect<void>;\n readonly hash: (text: string) => Effect.Effect<string>;\n readonly hashFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly ownedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly linkedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly readLink: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly mergeBase: (root: string, revision: string) => Effect.Effect<Option.Option<string>>;\n readonly originUrl: (root: string) => Effect.Effect<Option.Option<string>>;\n readonly history: (root: string) => Effect.Effect<string>;\n readonly changedFiles: (root: string, revision: string) => Effect.Effect<readonly string[]>;\n readonly commitMessages: (root: string, revision: string) => Effect.Effect<readonly string[]>;\n readonly readAtRevision: (\n root: string,\n revision: string,\n name: string,\n ) => Effect.Effect<Option.Option<string>>;\n readonly committedAt: (root: string, name: string) => Effect.Effect<Option.Option<number>>;\n readonly matchingFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly trackedFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredPaths: (\n root: string,\n paths: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly ignoredFiles: (\n root: string,\n pathspecs: readonly string[],\n ) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/shared/lib/repository-files/RepositoryFiles\") {}\n\nconst SUCCESS = 0;\n\ntype GitText = (root: string, args: readonly string[]) => Effect.Effect<Option.Option<string>>;\n\nconst gitTextService = Effect.gen(function* gitTextService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitText: GitText = (root, args) =>\n Effect.gen(function* readText() {\n const handle = yield* ChildProcess.make(\"git\", args, { cwd: root, stdin: \"ignore\" });\n const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n const code = yield* handle.exitCode;\n return Option.liftPredicate(text, () => code === SUCCESS);\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed(() => Option.none<string>()),\n );\n return gitText;\n});\n\ntype GitPaths = (\n root: string,\n args: readonly string[],\n separator: string,\n) => Effect.Effect<readonly string[]>;\n\nconst gitPathsService = Effect.gen(function* gitPathsService() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitPaths: GitPaths = (root, args, separator) =>\n Effect.gen(function* listPaths() {\n const handle = yield* ChildProcess.make(\"git\", args, {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, separator), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return gitPaths;\n});\n\nconst linkName = (entry: string): readonly string[] =>\n Option.toArray(groupOf(\"name\")(LINK_ENTRY.exec(entry)));\n\ntype CacheOperations = Pick<\n typeof RepositoryFiles.Service,\n \"walkDirectory\" | \"writeFile\" | \"removeFile\" | \"hash\" | \"hashFile\"\n>;\n\nconst encoder = new TextEncoder();\n\nconst cacheOperations = (\n fs: FileSystem.FileSystem,\n path: Path.Path,\n digest: Digest.Digest[\"Service\"],\n): CacheOperations => ({\n walkDirectory: (directory) =>\n fs\n .readDirectory(directory, { recursive: true })\n .pipe(Effect.orElseSucceed((): readonly string[] => [])),\n writeFile: (file, text) =>\n fs\n .makeDirectory(path.dirname(file), { recursive: true })\n .pipe(Effect.andThen(fs.writeFileString(file, text)), Effect.ignore),\n removeFile: (file) => fs.remove(file, { force: true }).pipe(Effect.ignore),\n hash: (text) => digest.digestHex(Digest.sha256, encoder.encode(text)),\n hashFile: (file) =>\n fs.readFile(file).pipe(\n Effect.flatMap((bytes) => digest.digestHex(Digest.sha256, bytes)),\n Effect.option,\n ),\n});\n\nconst gitFiles =\n (gitPaths: GitPaths) =>\n (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n gitPaths(root, [\"ls-files\", \"-z\", ...args], \"\\0\");\n\nconst gitHistory = (\n gitText: GitText,\n): Pick<RepositoryFiles[\"Service\"], \"commitMessages\" | \"committedAt\"> => ({\n commitMessages: (root, revision) =>\n gitText(root, [\"log\", `${revision}..HEAD`, \"--format=%B%x00\"]).pipe(\n Effect.map(\n Option.match({\n onNone: (): readonly string[] => [],\n onSome: (text) => Str.split(text, \"\\0\"),\n }),\n ),\n ),\n committedAt: (root, name) =>\n gitText(root, [\"log\", \"-1\", \"--format=%ct\", \"HEAD\", \"--\", name]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n Effect.map(Option.map((seconds) => Number(seconds) * MILLISECONDS)),\n ),\n});\n\nconst gitOperations = (\n gitPaths: GitPaths,\n gitText: GitText,\n): Pick<\n RepositoryFiles[\"Service\"],\n | \"changedFiles\"\n | \"ignoredFiles\"\n | \"ignoredPaths\"\n | \"linkedFiles\"\n | \"listedFiles\"\n | \"matchingFiles\"\n | \"mergeBase\"\n | \"originUrl\"\n | \"history\"\n | \"ownedFiles\"\n | \"readAtRevision\"\n | \"trackedFiles\"\n> => {\n const files = gitFiles(gitPaths);\n return {\n listedFiles: (root) => files(root, LISTED_ARGS),\n ownedFiles: (root) => files(root, [...LISTED_ARGS, \"--\", ...OWNED_PATHSPECS]),\n linkedFiles: (root) => files(root, STAGED_ARGS).pipe(Effect.map(Arr.flatMap(linkName))),\n mergeBase: (root, revision) =>\n gitText(root, [\"merge-base\", \"HEAD\", revision]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n originUrl: (root) =>\n gitText(root, [\"config\", \"--get\", \"remote.origin.url\"]).pipe(\n Effect.map(Option.map(Str.trim)),\n Effect.map(Option.filter(Str.isNonEmpty)),\n ),\n history: (root) => gitText(root, HISTORY_ARGS).pipe(Effect.map(Option.getOrElse(() => \"\"))),\n changedFiles: (root, revision) =>\n gitPaths(root, [\"diff\", \"--name-only\", \"--no-renames\", \"-z\", revision], \"\\0\"),\n readAtRevision: (root, revision, name) => gitText(root, [\"show\", `${revision}:${name}`]),\n matchingFiles: (root, pathspecs) => files(root, [...LISTED_ARGS, \"--\", ...pathspecs]),\n trackedFiles: (root, pathspecs) => files(root, [...TRACKED_ARGS, \"--\", ...pathspecs]),\n ignoredFiles: (root, pathspecs) => files(root, [...IGNORED_ARGS, \"--\", ...pathspecs]),\n ignoredPaths: (root, paths) => gitPaths(root, [\"check-ignore\", \"--\", ...paths], \"\\n\"),\n };\n};\n\nexport const nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const digest = yield* Digest.Digest;\n const gitPaths = yield* gitPathsService;\n const gitText = yield* gitTextService;\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(gitPaths)(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n ...gitOperations(gitPaths, gitText),\n ...gitHistory(gitText),\n readLink: (file) => fs.readLink(file).pipe(Effect.option),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n readBytes: (file) => fs.readFile(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n ...cacheOperations(fs, path, digest),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer), Layer.provide(Digest.layerWebCrypto));\n"],"mappings":";;;;;;;AAAA,MAAa,YAAY;;;AC0BzB,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB,CAAC,qCAAqC,oCAAoC;AAClG,MAAa,eAAe;;AAG5B,MAAa,aAAa;CAAC;CAAc;CAAsB;AAAS;AACxE,MAAM,cAAc;CAAC;CAAY;CAAY;CAAsB,aAAa,aAAa;AAAE;AAC/F,MAAM,eAAe;CAAC;CAAY;CAAa;AAAoB;AACnE,MAAM,eAAe,CAAC,UAAU;AAChC,MAAM,cAAc,CAAC,SAAS;AAC9B,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,aAAa;AAEnB,IAAa,kBAAb,cAAqC,QAAQ,QAqD3C,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC;AAEtE,MAAM,UAAU;AAIhB,MAAM,iBAAiB,OAAO,IAAI,UAAU,iBAAiB;CAC3D,MAAM,UAAU,OAAO,oBAAoB;CAC3C,MAAM,WAAoB,MAAM,SAC9B,OAAO,IAAI,UAAU,WAAW;E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