@r_masseater/msch 0.41.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/dist/cargo-inputs.d.mts +15 -0
- package/dist/cargo-inputs.mjs +281 -0
- package/dist/cargo-inputs.mjs.map +1 -0
- package/dist/changed.d.mts +1 -0
- package/dist/changed.mjs +178 -0
- package/dist/changed.mjs.map +1 -0
- package/dist/cli-contract-BY7vwgKc.mjs +41 -0
- package/dist/cli-contract-BY7vwgKc.mjs.map +1 -0
- package/dist/cli.mjs +1038 -1206
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +4 -2
- package/dist/config.mjs +26 -13
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-BYMl7wof.mjs → define-lint-preset-CxzPzVuB.mjs} +110 -80
- package/dist/define-lint-preset-CxzPzVuB.mjs.map +1 -0
- package/dist/{package-A62qq8pE.mjs → dependencies-v59cxwTD.mjs} +186 -165
- package/dist/dependencies-v59cxwTD.mjs.map +1 -0
- package/dist/ignored-directories-thSB0IAT.mjs +57 -0
- package/dist/ignored-directories-thSB0IAT.mjs.map +1 -0
- package/dist/{index-lM4Pphgz.d.mts → index-DL7PSp7j.d.mts} +21 -16
- package/dist/{index-CcVKuHBw.d.mts → index-DdJXnW1q.d.mts} +2 -2
- package/dist/lint.d.mts +2 -2
- package/dist/lint.mjs +1 -1
- package/dist/locked-closure-paths-Dtqs8uBU.mjs +7 -0
- package/dist/locked-closure-paths-Dtqs8uBU.mjs.map +1 -0
- package/dist/locked-inputs.d.mts +12 -0
- package/dist/locked-inputs.mjs +20 -0
- package/dist/locked-inputs.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -1
- package/dist/oxlint.mjs.map +1 -1
- package/dist/package-Bdv6W97F.mjs +144 -0
- package/dist/package-Bdv6W97F.mjs.map +1 -0
- package/dist/project-DeQcAglt.mjs +464 -0
- package/dist/project-DeQcAglt.mjs.map +1 -0
- package/dist/publish.d.mts +1 -0
- package/dist/publish.mjs +822 -0
- package/dist/publish.mjs.map +1 -0
- package/dist/reachable-Cc-255L3.mjs +13 -0
- package/dist/reachable-Cc-255L3.mjs.map +1 -0
- package/dist/{repository-files-CorshdqY.mjs → repository-files-aXwrITdF.mjs} +9 -2
- package/dist/repository-files-aXwrITdF.mjs.map +1 -0
- package/dist/runtime-GbrDfB8K.mjs +29 -0
- package/dist/runtime-GbrDfB8K.mjs.map +1 -0
- package/dist/started-once-CkTooI_o.mjs +13 -0
- package/dist/started-once-CkTooI_o.mjs.map +1 -0
- package/dist/{cli-contract-8SnKqhGw.mjs → syntax-ct2fFLtv.mjs} +9 -45
- package/dist/syntax-ct2fFLtv.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +11 -92
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +52 -34
- package/skills/msch-checks/SKILL.md +1 -6
- package/skills/publishing/SKILL.md +46 -0
- package/skills/repository-config/SKILL.md +21 -15
- package/skills/workspace-settings/SKILL.md +33 -3
- package/src/app/vite.d.ts +6 -0
- package/dist/cli-contract-8SnKqhGw.mjs.map +0 -1
- package/dist/define-lint-preset-BYMl7wof.mjs.map +0 -1
- package/dist/package-A62qq8pE.mjs.map +0 -1
- package/dist/repository-files-CorshdqY.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -2,24 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
msch packages the check policy shared across masseater's repositories. It requires Vite+ and Node.js 26 or later.
|
|
4
4
|
|
|
5
|
+
```sh
|
|
6
|
+
vp add -D @r_masseater/msch
|
|
7
|
+
vp exec msch
|
|
8
|
+
```
|
|
9
|
+
|
|
5
10
|
Guidance for agents ships in the package as TanStack Intent skills. Load one with `vp exec intent load @r_masseater/msch#<skill>`.
|
|
6
11
|
|
|
7
12
|
| Skill | When to use |
|
|
8
13
|
| -------------------- | ------------------------------------------- |
|
|
9
14
|
| `msch-checks` | Running msch and fixing what it reports |
|
|
15
|
+
| `publishing` | Releasing a workspace to npm or GitHub |
|
|
10
16
|
| `repository-config` | Building the root `vite.config.ts` |
|
|
11
17
|
| `workspace-settings` | Changing the settings of a single workspace |
|
|
12
18
|
|
|
13
19
|
The package has these entry points.
|
|
14
20
|
|
|
15
|
-
| Entry point | Contents
|
|
16
|
-
| -------------------------------------- |
|
|
17
|
-
| `msch` (bin) | Runs every check against the repository
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
| `@r_masseater/msch/
|
|
21
|
-
| `@r_masseater/msch/
|
|
22
|
-
| `@r_masseater/msch/
|
|
21
|
+
| Entry point | Contents |
|
|
22
|
+
| -------------------------------------- | ------------------------------------------------------------- |
|
|
23
|
+
| `msch` (bin) | Runs every check against the repository |
|
|
24
|
+
| `msch-changed` (bin) | Runs a command on the workspaces that changed since it passed |
|
|
25
|
+
| `msch-publish` (bin) | Plans and publishes a workspace to npm and GitHub Releases |
|
|
26
|
+
| `@r_masseater/msch/config` | `repositoryConfig`, which builds the root `vite.config.ts` |
|
|
27
|
+
| `@r_masseater/msch/workspace-settings` | `workspaceSettings`, which loads the settings of a workspace |
|
|
28
|
+
| `@r_masseater/msch/lint` | The oxlint preset and rule sets |
|
|
29
|
+
| `@r_masseater/msch/oxlint` | A JS plugin that reports msch findings as oxlint diagnostics |
|
|
30
|
+
| `@r_masseater/msch/decision-rules` | The decision rule plugin that the preset loads |
|
|
23
31
|
|
|
24
32
|
## Published to
|
|
25
33
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
|
+
type CargoInput = {
|
|
3
|
+
readonly pattern: string;
|
|
4
|
+
readonly base: "workspace";
|
|
5
|
+
} | {
|
|
6
|
+
readonly auto: true;
|
|
7
|
+
};
|
|
8
|
+
export declare const DERIVATION_READS: readonly CargoInput[];
|
|
9
|
+
interface CargoInputOptions {
|
|
10
|
+
readonly directory: string;
|
|
11
|
+
readonly extras?: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export declare const cargoInputs: (options: CargoInputOptions) => Promise<readonly CargoInput[]>;
|
|
14
|
+
export type { CargoInput, CargoInputOptions };
|
|
15
|
+
//# sourceMappingURL=cargo-inputs.d.mts.map
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { t as collectIgnoredDirectories } from "./ignored-directories-thSB0IAT.mjs";
|
|
2
|
+
import { i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles } from "./repository-files-aXwrITdF.mjs";
|
|
3
|
+
import { t as startedOnce } from "./started-once-CkTooI_o.mjs";
|
|
4
|
+
import { t as reachable } from "./reachable-Cc-255L3.mjs";
|
|
5
|
+
import { Array, Console, Effect, Layer, Option, Record, Schema, Stream, String as String$1, pipe } from "effect";
|
|
6
|
+
import { ChildProcess } from "effect/process";
|
|
7
|
+
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
8
|
+
const LOCK_FILE = "Cargo.lock";
|
|
9
|
+
const MANIFEST_FILE = "Cargo.toml";
|
|
10
|
+
const WORKSPACE_CACHE = "node_modules/.cache/msch/cargo-workspace.json";
|
|
11
|
+
const LAST_SEGMENT = /\/[^/]*$/u;
|
|
12
|
+
const IgnoredDirectory = Schema.Struct({
|
|
13
|
+
pattern: Schema.String,
|
|
14
|
+
base: Schema.Literal("workspace")
|
|
15
|
+
});
|
|
16
|
+
const CargoPackageSchema = Schema.Struct({
|
|
17
|
+
id: Schema.String,
|
|
18
|
+
name: Schema.String,
|
|
19
|
+
manifest_path: Schema.String,
|
|
20
|
+
source: Schema.NullOr(Schema.String)
|
|
21
|
+
});
|
|
22
|
+
const CargoNode = Schema.Struct({
|
|
23
|
+
id: Schema.String,
|
|
24
|
+
deps: Schema.Array(Schema.Struct({ pkg: Schema.String }))
|
|
25
|
+
});
|
|
26
|
+
const CargoMetadataSchema = Schema.Struct({
|
|
27
|
+
packages: Schema.Array(CargoPackageSchema),
|
|
28
|
+
resolve: Schema.Struct({ nodes: Schema.Array(CargoNode) }),
|
|
29
|
+
workspace_members: Schema.Array(Schema.String),
|
|
30
|
+
workspace_root: Schema.String
|
|
31
|
+
});
|
|
32
|
+
const CargoSourceSchema = Schema.Struct({
|
|
33
|
+
metadata: CargoMetadataSchema,
|
|
34
|
+
manifest: Schema.String
|
|
35
|
+
});
|
|
36
|
+
Schema.Struct({
|
|
37
|
+
...CargoSourceSchema.fields,
|
|
38
|
+
ignored: Schema.Array(IgnoredDirectory)
|
|
39
|
+
});
|
|
40
|
+
const normalized = String$1.replaceAll("\\", "/");
|
|
41
|
+
const relativeTo = (root) => (file) => {
|
|
42
|
+
const prefix = `${normalized(root)}/`;
|
|
43
|
+
const path = normalized(file);
|
|
44
|
+
return Option.some(String$1.slice(prefix.length)(path)).pipe(Option.filter(() => String$1.startsWith(prefix)(path)));
|
|
45
|
+
};
|
|
46
|
+
const directoryOf = (file) => pipe(normalized(file), String$1.replace(LAST_SEGMENT, ""));
|
|
47
|
+
const isWithin = (directory) => (path) => String$1.isEmpty(directory) || path === directory || String$1.startsWith(`${directory}/`)(path);
|
|
48
|
+
const isLocal = (entry) => entry.source === null;
|
|
49
|
+
const closureOf = (metadata) => (roots) => {
|
|
50
|
+
const edges = Record.fromEntries(pipe(metadata.resolve.nodes, Array.map((node) => [node.id, pipe(node.deps, Array.map(({ pkg }) => pkg))])));
|
|
51
|
+
const ids = new Set(reachable(edges, roots));
|
|
52
|
+
return pipe(metadata.packages, Array.filter((entry) => ids.has(entry.id)));
|
|
53
|
+
};
|
|
54
|
+
// src/features/derive-cargo-inputs/model/root-manifest.ts
|
|
55
|
+
const WORKSPACE = "workspace";
|
|
56
|
+
const PROFILE = "profile";
|
|
57
|
+
const PACKAGE = "package";
|
|
58
|
+
const MEMBER_LISTS = /* @__PURE__ */ new Set([
|
|
59
|
+
"members",
|
|
60
|
+
"exclude",
|
|
61
|
+
"default-members"
|
|
62
|
+
]);
|
|
63
|
+
const EVERY_PACKAGE = "*";
|
|
64
|
+
const VERSION_MARK = "@";
|
|
65
|
+
const URL_MARK = "/";
|
|
66
|
+
const taggedError$1 = Schema.TaggedError;
|
|
67
|
+
var ManifestUnreadable = class extends taggedError$1()("ManifestUnreadable", { file: Schema.String }) {};
|
|
68
|
+
const ManifestJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));
|
|
69
|
+
const decodeManifest = Schema.decodeUnknownOption(ManifestJson);
|
|
70
|
+
const encodeManifest = Schema.encodeOption(ManifestJson);
|
|
71
|
+
const encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
72
|
+
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
73
|
+
const mapTable = (change) => (value) => pipe(decodeTable(value), Option.map(change), Option.getOrElse(() => value));
|
|
74
|
+
const mapField = (name, change) => (table) => {
|
|
75
|
+
if (!Record.has(table, name)) return table;
|
|
76
|
+
return {
|
|
77
|
+
...table,
|
|
78
|
+
[name]: change(table[name])
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const nameOf = (spec) => Array.headNonEmpty(String$1.split(spec, VERSION_MARK));
|
|
82
|
+
const overrides = (closure) => (spec) => spec === EVERY_PACKAGE || String$1.includes(URL_MARK)(spec) || pipe(closure, Array.contains(nameOf(spec)));
|
|
83
|
+
const withoutMembers = (workspace) => pipe(workspace, Record.filter((_value, key) => !MEMBER_LISTS.has(key)));
|
|
84
|
+
const keptOverrides = (closure) => {
|
|
85
|
+
const applies = overrides(closure);
|
|
86
|
+
return mapTable((packages) => pipe(packages, Record.filter((_value, spec) => applies(spec))));
|
|
87
|
+
};
|
|
88
|
+
const profilesFor = (closure) => {
|
|
89
|
+
const profileFor = mapTable(mapField(PACKAGE, keptOverrides(closure)));
|
|
90
|
+
return mapTable(Record.map(profileFor));
|
|
91
|
+
};
|
|
92
|
+
const withoutMemberLists = mapField(WORKSPACE, mapTable(withoutMembers));
|
|
93
|
+
const readManifest = Effect.fn("readManifest")(function* readManifest(root) {
|
|
94
|
+
const files = yield* RepositoryFiles;
|
|
95
|
+
const file = files.join(root, MANIFEST_FILE);
|
|
96
|
+
const text = yield* files.readFile(file);
|
|
97
|
+
const value = yield* Effect.try({
|
|
98
|
+
try: () => getStaticTOMLValue(parseTOML(Option.getOrElse(text, () => ""))),
|
|
99
|
+
catch: () => ManifestUnreadable.make({ file })
|
|
100
|
+
});
|
|
101
|
+
return yield* encodeJson(value);
|
|
102
|
+
});
|
|
103
|
+
const manifestFor = (closure) => (manifest) => {
|
|
104
|
+
const forClosure = mapField(PROFILE, profilesFor(closure));
|
|
105
|
+
return pipe(decodeManifest(manifest), Option.map(withoutMemberLists), Option.map(forClosure), Option.flatMap(encodeManifest), Option.getOrElse(() => manifest));
|
|
106
|
+
};
|
|
107
|
+
// src/features/derive-cargo-inputs/model/cargo-inputs.ts
|
|
108
|
+
const NEGATION = "!";
|
|
109
|
+
const CONTENTS = "/**";
|
|
110
|
+
const ANYWHERE = "**/";
|
|
111
|
+
const CLOSURE_DIRECTORY = "node_modules/.cache/msch/cargo-inputs";
|
|
112
|
+
const CLOSURE_SUFFIX = ".lock";
|
|
113
|
+
const ROOT_SLUG = "root";
|
|
114
|
+
const SLUG_SEPARATOR = "__";
|
|
115
|
+
const LINE = "\n";
|
|
116
|
+
const WORKSPACE_FILES = ["rust-toolchain.toml", ".cargo/**"];
|
|
117
|
+
const GENERATED = ["node_modules", "dist"];
|
|
118
|
+
const workspaceInput = (pattern) => ({
|
|
119
|
+
pattern,
|
|
120
|
+
base: "workspace"
|
|
121
|
+
});
|
|
122
|
+
const DERIVATION_READS = pipe([
|
|
123
|
+
LOCK_FILE,
|
|
124
|
+
MANIFEST_FILE,
|
|
125
|
+
WORKSPACE_CACHE,
|
|
126
|
+
`${CLOSURE_DIRECTORY}${CONTENTS}`
|
|
127
|
+
], Array.map((file) => workspaceInput(`${NEGATION}${file}`)));
|
|
128
|
+
const withoutContents = String$1.replace(CONTENTS, "");
|
|
129
|
+
const slugOf = (owner) => Option.match(Option.liftPredicate(owner, String$1.isNonEmpty), {
|
|
130
|
+
onNone: () => ROOT_SLUG,
|
|
131
|
+
onSome: String$1.replaceAll("/", SLUG_SEPARATOR)
|
|
132
|
+
});
|
|
133
|
+
const ownedRoots = (metadata, owner) => {
|
|
134
|
+
const relative = relativeTo(metadata.workspace_root);
|
|
135
|
+
const owned = new Set(pipe(metadata.packages, Array.filter((entry) => pipe(relative(directoryOf(entry.manifest_path)), Option.exists(isWithin(owner)))), Array.map((entry) => entry.id)));
|
|
136
|
+
return pipe(metadata.workspace_members, Array.filter((id) => owned.has(id)));
|
|
137
|
+
};
|
|
138
|
+
const scopedExtra = (owner) => (extra) => {
|
|
139
|
+
if (String$1.startsWith(NEGATION)(extra)) return `${NEGATION}${owner}/${String$1.slice(1)(extra)}`;
|
|
140
|
+
return `${owner}/${extra}`;
|
|
141
|
+
};
|
|
142
|
+
const excludedFrom = (workspace, walked, kept) => pipe(workspace.ignored, Array.filter(({ pattern }) => {
|
|
143
|
+
const covered = withoutContents(String$1.slice(1)(pattern));
|
|
144
|
+
return (String$1.startsWith(ANYWHERE)(covered) || pipe(walked, Array.some((dir) => isWithin(dir)(covered)))) && !pipe(kept, Array.some(isWithin(covered)));
|
|
145
|
+
}));
|
|
146
|
+
const generatedIn = (walked) => pipe(walked, Array.flatMap((dir) => pipe(GENERATED, Array.map((name) => `${NEGATION}${dir}/${ANYWHERE}${name}${CONTENTS}`))));
|
|
147
|
+
const externalIds = (closure) => pipe(closure, Array.filter((entry) => !isLocal(entry)), Array.map((entry) => entry.id));
|
|
148
|
+
const closureText = (manifest, closure) => {
|
|
149
|
+
const names = pipe(closure, Array.map((entry) => entry.name));
|
|
150
|
+
return Array.join([...Array.sort(externalIds(closure), String$1.Order), manifestFor(names)(manifest)], LINE);
|
|
151
|
+
};
|
|
152
|
+
/** @internal */
|
|
153
|
+
const cargoInputsOf = ({ workspace, directory, extras }) => {
|
|
154
|
+
const { metadata } = workspace;
|
|
155
|
+
const relative = relativeTo(metadata.workspace_root);
|
|
156
|
+
const owner = Option.getOrElse(relative(directory), () => "");
|
|
157
|
+
const closure = closureOf(metadata)(ownedRoots(metadata, owner));
|
|
158
|
+
const walked = Array.sort(pipe(closure, Array.filter(isLocal), Array.flatMap((entry) => Option.toArray(relative(directoryOf(entry.manifest_path))))), String$1.Order);
|
|
159
|
+
const added = pipe(extras, Array.map(scopedExtra(owner)));
|
|
160
|
+
const kept = pipe(added, Array.filter((extra) => !String$1.startsWith(NEGATION)(extra)), Array.map(withoutContents));
|
|
161
|
+
const closureFile = `${CLOSURE_DIRECTORY}/${slugOf(owner)}${CLOSURE_SUFFIX}`;
|
|
162
|
+
return {
|
|
163
|
+
inputs: [
|
|
164
|
+
...pipe(walked, Array.map((dir) => workspaceInput(`${dir}${CONTENTS}`))),
|
|
165
|
+
workspaceInput(closureFile),
|
|
166
|
+
...pipe(WORKSPACE_FILES, Array.map(workspaceInput)),
|
|
167
|
+
...excludedFrom(workspace, walked, kept),
|
|
168
|
+
...pipe(generatedIn(walked), Array.map(workspaceInput)),
|
|
169
|
+
...pipe(added, Array.map(workspaceInput))
|
|
170
|
+
],
|
|
171
|
+
closureFile,
|
|
172
|
+
closure: closureText(workspace.manifest, closure)
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
// src/features/derive-cargo-inputs/model/derive.ts
|
|
176
|
+
const KEY_SEPARATOR = "\0";
|
|
177
|
+
const SUCCESS = 0;
|
|
178
|
+
const KEYS = [LOCK_FILE, MANIFEST_FILE];
|
|
179
|
+
const METADATA_ARGS = [
|
|
180
|
+
"metadata",
|
|
181
|
+
"--format-version",
|
|
182
|
+
"1",
|
|
183
|
+
"--offline",
|
|
184
|
+
"--locked"
|
|
185
|
+
];
|
|
186
|
+
const CachedSource = Schema.fromJsonString(Schema.Struct({
|
|
187
|
+
fingerprint: Schema.String,
|
|
188
|
+
source: CargoSourceSchema
|
|
189
|
+
}));
|
|
190
|
+
const decodeMetadata = Schema.decodeUnknownEffect(Schema.fromJsonString(CargoMetadataSchema));
|
|
191
|
+
const decodeCached = Schema.decodeUnknownOption(CachedSource);
|
|
192
|
+
const encodeCached = Schema.encodeEffect(CachedSource);
|
|
193
|
+
const taggedError = Schema.TaggedError;
|
|
194
|
+
var MetadataFailed = class extends taggedError()("MetadataFailed", { output: Schema.String }) {};
|
|
195
|
+
const AUTO = [{ auto: true }];
|
|
196
|
+
const nodeLayer = Layer.provideMerge(nodeRepositoryFiles, nodeServicesLayer);
|
|
197
|
+
const fingerprintOf = Effect.fn("fingerprintOf")(function* fingerprintOf(root) {
|
|
198
|
+
const files = yield* RepositoryFiles;
|
|
199
|
+
const texts = yield* Effect.forEach(KEYS, (key) => files.readFile(files.join(root, key)), { concurrency: "unbounded" });
|
|
200
|
+
return yield* files.hash(pipe(texts, Array.map((text) => Option.getOrElse(text, () => "")), Array.join(KEY_SEPARATOR)));
|
|
201
|
+
});
|
|
202
|
+
const cachedSource = Effect.fn("cachedSource")(function* cachedSource(root) {
|
|
203
|
+
const files = yield* RepositoryFiles;
|
|
204
|
+
const text = yield* files.readFile(files.join(root, WORKSPACE_CACHE));
|
|
205
|
+
const fingerprint = yield* fingerprintOf(root);
|
|
206
|
+
return text.pipe(Option.flatMap(decodeCached), Option.filter((cached) => cached.fingerprint === fingerprint), Option.map((cached) => cached.source));
|
|
207
|
+
});
|
|
208
|
+
const metadataIn = Effect.fn("metadataIn")(function* metadataIn(root) {
|
|
209
|
+
const handle = yield* ChildProcess.make("cargo", METADATA_ARGS, {
|
|
210
|
+
cwd: root,
|
|
211
|
+
extendEnv: true,
|
|
212
|
+
stdin: "ignore"
|
|
213
|
+
});
|
|
214
|
+
const [output, problem] = yield* Effect.all([handle.stdout.pipe(Stream.decodeText(), Stream.mkString), handle.stderr.pipe(Stream.decodeText(), Stream.mkString)], { concurrency: "unbounded" });
|
|
215
|
+
if ((yield* handle.exitCode) !== SUCCESS) return yield* MetadataFailed.make({ output: String$1.trim(problem) });
|
|
216
|
+
return yield* decodeMetadata(output);
|
|
217
|
+
}, Effect.scoped);
|
|
218
|
+
const readSource = Effect.fn("readSource")(function* readSource(root) {
|
|
219
|
+
const files = yield* RepositoryFiles;
|
|
220
|
+
const source = {
|
|
221
|
+
metadata: yield* metadataIn(root),
|
|
222
|
+
manifest: yield* readManifest(root)
|
|
223
|
+
};
|
|
224
|
+
const text = yield* encodeCached({
|
|
225
|
+
fingerprint: yield* fingerprintOf(root),
|
|
226
|
+
source
|
|
227
|
+
});
|
|
228
|
+
yield* files.writeFile(files.join(root, WORKSPACE_CACHE), text);
|
|
229
|
+
return source;
|
|
230
|
+
});
|
|
231
|
+
const workspaceIn = Effect.fn("workspaceIn")(function* workspaceIn(root) {
|
|
232
|
+
const cached = yield* cachedSource(root);
|
|
233
|
+
return {
|
|
234
|
+
...yield* Option.match(cached, {
|
|
235
|
+
onNone: () => readSource(root),
|
|
236
|
+
onSome: Effect.succeed
|
|
237
|
+
}),
|
|
238
|
+
ignored: yield* collectIgnoredDirectories(root)
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
const warn = (root, reason) => Console.error(`msch: the cargo workspace in ${root} could not be read, so its cargo tasks track every file they read: ${reason}`);
|
|
242
|
+
const loaded = (root) => workspaceIn(root).pipe(Effect.asSome, Effect.catchTag("MetadataFailed", ({ output }) => Effect.fail(output)), Effect.tapError((cause) => warn(root, String(cause))), Effect.orElseSucceed(() => Option.none()));
|
|
243
|
+
const loadedOnce = startedOnce();
|
|
244
|
+
const loadWorkspace = (root) => loadedOnce(root, () => Effect.runPromise(loaded(root).pipe(Effect.provide(nodeLayer))));
|
|
245
|
+
const lockDirectory = (directory) => Effect.gen(function* findLockDirectory() {
|
|
246
|
+
const files = yield* RepositoryFiles;
|
|
247
|
+
if (yield* files.exists(files.join(directory, "Cargo.lock"))) return Option.some(directory);
|
|
248
|
+
const parent = files.dirname(directory);
|
|
249
|
+
if (parent === directory) return Option.none();
|
|
250
|
+
return yield* lockDirectory(parent);
|
|
251
|
+
});
|
|
252
|
+
const writeClosure = Effect.fn("writeClosure")(function* writeClosure(root, derived) {
|
|
253
|
+
const files = yield* RepositoryFiles;
|
|
254
|
+
const file = files.join(root, derived.closureFile);
|
|
255
|
+
const written = yield* files.readFile(file);
|
|
256
|
+
if (!Option.exists(written, (text) => text === derived.closure)) yield* files.writeFile(file, derived.closure);
|
|
257
|
+
return derived.inputs;
|
|
258
|
+
});
|
|
259
|
+
const inputsIn = Effect.fn("inputsIn")(function* inputsIn(root, directory, extras) {
|
|
260
|
+
const workspace = yield* Effect.promise(() => loadWorkspace(root));
|
|
261
|
+
return yield* Option.match(workspace, {
|
|
262
|
+
onNone: () => Effect.succeed(AUTO),
|
|
263
|
+
onSome: (found) => writeClosure(root, cargoInputsOf({
|
|
264
|
+
workspace: found,
|
|
265
|
+
directory,
|
|
266
|
+
extras
|
|
267
|
+
}))
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
const deriveCargoInputs = Effect.fn("deriveCargoInputs")(function* deriveCargoInputs({ directory, extras = [] }) {
|
|
271
|
+
const absolute = (yield* RepositoryFiles).resolve(directory);
|
|
272
|
+
const root = yield* lockDirectory(absolute);
|
|
273
|
+
return yield* Option.match(root, {
|
|
274
|
+
onNone: () => Effect.succeed(AUTO),
|
|
275
|
+
onSome: (found) => inputsIn(found, absolute, extras)
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
const cargoInputs = (options) => Effect.runPromise(deriveCargoInputs(options).pipe(Effect.provide(nodeLayer)));
|
|
279
|
+
export { DERIVATION_READS, cargoInputs };
|
|
280
|
+
|
|
281
|
+
//# sourceMappingURL=cargo-inputs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cargo-inputs.mjs","names":["Str","Rec","Arr","taggedError","Rec","Arr","Str","Arr","Str","Arr","Str"],"sources":["../src/features/derive-cargo-inputs/model/cargo-metadata.ts","../src/features/derive-cargo-inputs/model/root-manifest.ts","../src/features/derive-cargo-inputs/model/cargo-inputs.ts","../src/features/derive-cargo-inputs/model/derive.ts"],"sourcesContent":["import { Array as Arr, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\n\nimport { reachable } from \"#/shared/lib/reachable.ts\";\n\nexport const SEPARATOR = \"/\";\nexport const LOCK_FILE = \"Cargo.lock\";\nexport const MANIFEST_FILE = \"Cargo.toml\";\nexport const WORKSPACE_CACHE = \"node_modules/.cache/msch/cargo-workspace.json\";\nconst LAST_SEGMENT = /\\/[^/]*$/u;\n\nconst IgnoredDirectory = Schema.Struct({\n pattern: Schema.String,\n base: Schema.Literal(\"workspace\"),\n});\nconst CargoPackageSchema = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n manifest_path: Schema.String,\n source: Schema.NullOr(Schema.String),\n});\nconst CargoNode = Schema.Struct({\n id: Schema.String,\n deps: Schema.Array(Schema.Struct({ pkg: Schema.String })),\n});\nexport const CargoMetadataSchema = Schema.Struct({\n packages: Schema.Array(CargoPackageSchema),\n resolve: Schema.Struct({ nodes: Schema.Array(CargoNode) }),\n workspace_members: Schema.Array(Schema.String),\n workspace_root: Schema.String,\n});\nexport const CargoSourceSchema = Schema.Struct({\n metadata: CargoMetadataSchema,\n manifest: Schema.String,\n});\nexport const CargoWorkspaceSchema = Schema.Struct({\n ...CargoSourceSchema.fields,\n ignored: Schema.Array(IgnoredDirectory),\n});\nexport type CargoMetadata = typeof CargoMetadataSchema.Type;\nexport type CargoSource = typeof CargoSourceSchema.Type;\nexport type CargoWorkspace = typeof CargoWorkspaceSchema.Type;\nexport type CargoPackage = typeof CargoPackageSchema.Type;\n\nconst normalized = Str.replaceAll(\"\\\\\", SEPARATOR);\n\nexport const relativeTo =\n (root: string) =>\n (file: string): Option.Option<string> => {\n const prefix = `${normalized(root)}${SEPARATOR}`;\n const path = normalized(file);\n return Option.some(Str.slice(prefix.length)(path)).pipe(\n Option.filter(() => Str.startsWith(prefix)(path)),\n );\n };\n\nexport const directoryOf = (file: string): string =>\n pipe(normalized(file), Str.replace(LAST_SEGMENT, \"\"));\n\nexport const isWithin =\n (directory: string) =>\n (path: string): boolean =>\n Str.isEmpty(directory) ||\n path === directory ||\n Str.startsWith(`${directory}${SEPARATOR}`)(path);\n\nexport const isLocal = (entry: CargoPackage): boolean => entry.source === null;\n\nexport const closureOf =\n (metadata: CargoMetadata) =>\n (roots: readonly string[]): readonly CargoPackage[] => {\n const edges = Rec.fromEntries(\n pipe(\n metadata.resolve.nodes,\n Arr.map(\n (node) =>\n [\n node.id,\n pipe(\n node.deps,\n Arr.map(({ pkg }) => pkg),\n ),\n ] as const,\n ),\n ),\n );\n const ids = new Set(reachable(edges, roots));\n return pipe(\n metadata.packages,\n Arr.filter((entry) => ids.has(entry.id)),\n );\n };\n","import { Array as Arr, Effect, Option, Record as Rec, Schema, String as Str, pipe } from \"effect\";\nimport { getStaticTOMLValue, parseTOML } from \"toml-eslint-parser\";\n\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { MANIFEST_FILE } from \"./cargo-metadata.ts\";\n\nconst WORKSPACE = \"workspace\";\nconst PROFILE = \"profile\";\nconst PACKAGE = \"package\";\nconst MEMBER_LISTS = new Set([\"members\", \"exclude\", \"default-members\"]);\nconst EVERY_PACKAGE = \"*\";\nconst VERSION_MARK = \"@\";\nconst URL_MARK = \"/\";\n\ntype Table = Readonly<Record<string, unknown>>;\n\nconst taggedError = Schema.TaggedError;\n\nclass ManifestUnreadable extends taggedError<\n ManifestUnreadable,\n { readonly brand: unique symbol }\n>()(\"ManifestUnreadable\", { file: Schema.String }) {}\n\nconst ManifestJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));\nconst decodeManifest = Schema.decodeUnknownOption(ManifestJson);\nconst encodeManifest = Schema.encodeOption(ManifestJson);\nconst encodeJson = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\nconst decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));\n\nconst mapTable =\n (change: (table: Table) => Table) =>\n (value: unknown): unknown =>\n pipe(\n decodeTable(value),\n Option.map(change),\n Option.getOrElse(() => value),\n );\n\nconst mapField =\n (name: string, change: (value: unknown) => unknown) =>\n (table: Table): Table => {\n if (!Rec.has(table, name)) {\n return table;\n }\n return { ...table, [name]: change(table[name]) };\n };\n\nconst nameOf = (spec: string): string => Arr.headNonEmpty(Str.split(spec, VERSION_MARK));\n\nconst overrides =\n (closure: readonly string[]) =>\n (spec: string): boolean =>\n spec === EVERY_PACKAGE ||\n Str.includes(URL_MARK)(spec) ||\n pipe(closure, Arr.contains(nameOf(spec)));\n\nconst withoutMembers = (workspace: Table): Table =>\n pipe(\n workspace,\n Rec.filter((_value, key) => !MEMBER_LISTS.has(key)),\n );\n\nconst keptOverrides = (closure: readonly string[]): ((packages: unknown) => unknown) => {\n const applies = overrides(closure);\n return mapTable((packages) =>\n pipe(\n packages,\n Rec.filter((_value, spec) => applies(spec)),\n ),\n );\n};\n\nconst profilesFor = (closure: readonly string[]): ((profiles: unknown) => unknown) => {\n const profileFor = mapTable(mapField(PACKAGE, keptOverrides(closure)));\n return mapTable(Rec.map(profileFor));\n};\n\nconst withoutMemberLists = mapField(WORKSPACE, mapTable(withoutMembers));\n\nexport const readManifest = Effect.fn(\"readManifest\")(function* readManifest(root: string) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, MANIFEST_FILE);\n const text = yield* files.readFile(file);\n const value = yield* Effect.try({\n try: () => getStaticTOMLValue(parseTOML(Option.getOrElse(text, () => \"\"))),\n catch: () => ManifestUnreadable.make({ file }),\n });\n return yield* encodeJson(value);\n});\n\nexport const manifestFor =\n (closure: readonly string[]) =>\n (manifest: string): string => {\n const forClosure = mapField(PROFILE, profilesFor(closure));\n return pipe(\n decodeManifest(manifest),\n Option.map(withoutMemberLists),\n Option.map(forClosure),\n Option.flatMap(encodeManifest),\n Option.getOrElse(() => manifest),\n );\n };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n LOCK_FILE,\n MANIFEST_FILE,\n SEPARATOR,\n WORKSPACE_CACHE,\n closureOf,\n directoryOf,\n isLocal,\n isWithin,\n relativeTo,\n} from \"./cargo-metadata.ts\";\nimport type { CargoMetadata, CargoPackage, CargoWorkspace } from \"./cargo-metadata.ts\";\nimport { manifestFor } from \"./root-manifest.ts\";\n\nconst NEGATION = \"!\";\nconst CONTENTS = \"/**\";\nconst ANYWHERE = \"**/\";\nconst CLOSURE_DIRECTORY = \"node_modules/.cache/msch/cargo-inputs\";\nconst CLOSURE_SUFFIX = \".lock\";\nconst ROOT_SLUG = \"root\";\nconst SLUG_SEPARATOR = \"__\";\nconst LINE = \"\\n\";\nconst WORKSPACE_FILES = [\"rust-toolchain.toml\", \".cargo/**\"] as const;\nconst GENERATED = [\"node_modules\", \"dist\"] as const;\n\nexport type CargoInput =\n | { readonly pattern: string; readonly base: \"workspace\" }\n | { readonly auto: true };\n\nexport interface DerivedInputs {\n readonly inputs: readonly CargoInput[];\n readonly closureFile: string;\n readonly closure: string;\n}\n\nexport interface CargoInputRequest {\n readonly workspace: CargoWorkspace;\n readonly directory: string;\n readonly extras: readonly string[];\n}\n\nconst workspaceInput = (pattern: string): CargoInput => ({ pattern, base: \"workspace\" });\n\nexport const DERIVATION_READS: readonly CargoInput[] = pipe(\n [LOCK_FILE, MANIFEST_FILE, WORKSPACE_CACHE, `${CLOSURE_DIRECTORY}${CONTENTS}`],\n Arr.map((file) => workspaceInput(`${NEGATION}${file}`)),\n);\n\nconst withoutContents = Str.replace(CONTENTS, \"\");\n\nconst slugOf = (owner: string): string =>\n Option.match(Option.liftPredicate(owner, Str.isNonEmpty), {\n onNone: () => ROOT_SLUG,\n onSome: Str.replaceAll(SEPARATOR, SLUG_SEPARATOR),\n });\n\nconst ownedRoots = (metadata: CargoMetadata, owner: string): readonly string[] => {\n const relative = relativeTo(metadata.workspace_root);\n const owned = new Set(\n pipe(\n metadata.packages,\n Arr.filter((entry) =>\n pipe(relative(directoryOf(entry.manifest_path)), Option.exists(isWithin(owner))),\n ),\n Arr.map((entry) => entry.id),\n ),\n );\n return pipe(\n metadata.workspace_members,\n Arr.filter((id) => owned.has(id)),\n );\n};\n\nconst scopedExtra =\n (owner: string) =>\n (extra: string): string => {\n if (Str.startsWith(NEGATION)(extra)) {\n return `${NEGATION}${owner}${SEPARATOR}${Str.slice(NEGATION.length)(extra)}`;\n }\n return `${owner}${SEPARATOR}${extra}`;\n };\n\nconst excludedFrom = (\n workspace: CargoWorkspace,\n walked: readonly string[],\n kept: readonly string[],\n): readonly CargoInput[] =>\n pipe(\n workspace.ignored,\n Arr.filter(({ pattern }) => {\n const covered = withoutContents(Str.slice(NEGATION.length)(pattern));\n const applies =\n Str.startsWith(ANYWHERE)(covered) ||\n pipe(\n walked,\n Arr.some((dir) => isWithin(dir)(covered)),\n );\n return applies && !pipe(kept, Arr.some(isWithin(covered)));\n }),\n );\n\nconst generatedIn = (walked: readonly string[]): readonly string[] =>\n pipe(\n walked,\n Arr.flatMap((dir) =>\n pipe(\n GENERATED,\n Arr.map((name) => `${NEGATION}${dir}${SEPARATOR}${ANYWHERE}${name}${CONTENTS}`),\n ),\n ),\n );\n\nconst externalIds = (closure: readonly CargoPackage[]): readonly string[] =>\n pipe(\n closure,\n Arr.filter((entry) => !isLocal(entry)),\n Arr.map((entry) => entry.id),\n );\n\nconst closureText = (manifest: string, closure: readonly CargoPackage[]): string => {\n const names = pipe(\n closure,\n Arr.map((entry) => entry.name),\n );\n return Arr.join(\n [...Arr.sort(externalIds(closure), Str.Order), manifestFor(names)(manifest)],\n LINE,\n );\n};\n\n/** @internal */\nexport const cargoInputsOf = ({\n workspace,\n directory,\n extras,\n}: CargoInputRequest): DerivedInputs => {\n const { metadata } = workspace;\n const relative = relativeTo(metadata.workspace_root);\n const owner = Option.getOrElse(relative(directory), () => \"\");\n const closure = closureOf(metadata)(ownedRoots(metadata, owner));\n const walked = Arr.sort(\n pipe(\n closure,\n Arr.filter(isLocal),\n Arr.flatMap((entry) => Option.toArray(relative(directoryOf(entry.manifest_path)))),\n ),\n Str.Order,\n );\n const added = pipe(extras, Arr.map(scopedExtra(owner)));\n const kept = pipe(\n added,\n Arr.filter((extra) => !Str.startsWith(NEGATION)(extra)),\n Arr.map(withoutContents),\n );\n const closureFile = `${CLOSURE_DIRECTORY}${SEPARATOR}${slugOf(owner)}${CLOSURE_SUFFIX}`;\n return {\n inputs: [\n ...pipe(\n walked,\n Arr.map((dir) => workspaceInput(`${dir}${CONTENTS}`)),\n ),\n workspaceInput(closureFile),\n ...pipe(WORKSPACE_FILES, Arr.map(workspaceInput)),\n ...excludedFrom(workspace, walked, kept),\n ...pipe(generatedIn(walked), Arr.map(workspaceInput)),\n ...pipe(added, Arr.map(workspaceInput)),\n ],\n closureFile,\n closure: closureText(workspace.manifest, closure),\n };\n};\n","import {\n Array as Arr,\n Console,\n Effect,\n Layer,\n Option,\n Schema,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport { ChildProcess } from \"effect/process\";\n\nimport { collectIgnoredDirectories } from \"#/shared/lib/ignored-directories.ts\";\nimport {\n RepositoryFiles,\n nodeRepositoryFiles,\n nodeServicesLayer,\n} from \"#/shared/lib/repository-files.ts\";\nimport { startedOnce } from \"#/shared/lib/started-once.ts\";\n\nimport { cargoInputsOf } from \"./cargo-inputs.ts\";\nimport type { CargoInput, DerivedInputs } from \"./cargo-inputs.ts\";\nimport {\n CargoMetadataSchema,\n CargoSourceSchema,\n LOCK_FILE,\n MANIFEST_FILE,\n WORKSPACE_CACHE,\n} from \"./cargo-metadata.ts\";\nimport type { CargoSource, CargoWorkspace } from \"./cargo-metadata.ts\";\nimport { readManifest } from \"./root-manifest.ts\";\n\nconst KEY_SEPARATOR = \"\\u0000\";\nconst SUCCESS = 0;\nconst KEYS = [LOCK_FILE, MANIFEST_FILE] as const;\nconst METADATA_ARGS = [\"metadata\", \"--format-version\", \"1\", \"--offline\", \"--locked\"];\n\nconst CachedSource = Schema.fromJsonString(\n Schema.Struct({\n fingerprint: Schema.String,\n source: CargoSourceSchema,\n }),\n);\nconst decodeMetadata = Schema.decodeUnknownEffect(Schema.fromJsonString(CargoMetadataSchema));\nconst decodeCached = Schema.decodeUnknownOption(CachedSource);\nconst encodeCached = Schema.encodeEffect(CachedSource);\n\nconst taggedError = Schema.TaggedError;\n\nclass MetadataFailed extends taggedError<MetadataFailed, { readonly brand: unique symbol }>()(\n \"MetadataFailed\",\n { output: Schema.String },\n) {}\n\nconst AUTO: readonly CargoInput[] = [{ auto: true }];\nconst nodeLayer = Layer.provideMerge(nodeRepositoryFiles, nodeServicesLayer);\n\nexport interface CargoInputOptions {\n readonly directory: string;\n readonly extras?: readonly string[];\n}\n\nconst fingerprintOf = Effect.fn(\"fingerprintOf\")(function* fingerprintOf(root: string) {\n const files = yield* RepositoryFiles;\n const texts = yield* Effect.forEach(KEYS, (key) => files.readFile(files.join(root, key)), {\n concurrency: \"unbounded\",\n });\n return yield* files.hash(\n pipe(\n texts,\n Arr.map((text) => Option.getOrElse(text, () => \"\")),\n Arr.join(KEY_SEPARATOR),\n ),\n );\n});\n\nconst cachedSource = Effect.fn(\"cachedSource\")(function* cachedSource(root: string) {\n const files = yield* RepositoryFiles;\n const text = yield* files.readFile(files.join(root, WORKSPACE_CACHE));\n const fingerprint = yield* fingerprintOf(root);\n return text.pipe(\n Option.flatMap(decodeCached),\n Option.filter((cached) => cached.fingerprint === fingerprint),\n Option.map((cached) => cached.source),\n );\n});\n\nconst metadataIn = Effect.fn(\"metadataIn\")(function* metadataIn(root: string) {\n const handle = yield* ChildProcess.make(\"cargo\", METADATA_ARGS, {\n cwd: root,\n extendEnv: true,\n stdin: \"ignore\",\n });\n const [output, problem] = yield* Effect.all(\n [\n handle.stdout.pipe(Stream.decodeText(), Stream.mkString),\n handle.stderr.pipe(Stream.decodeText(), Stream.mkString),\n ],\n { concurrency: \"unbounded\" },\n );\n const code = yield* handle.exitCode;\n if (code !== SUCCESS) {\n return yield* MetadataFailed.make({ output: Str.trim(problem) });\n }\n return yield* decodeMetadata(output);\n}, Effect.scoped);\n\nconst readSource = Effect.fn(\"readSource\")(function* readSource(root: string) {\n const files = yield* RepositoryFiles;\n const source: CargoSource = {\n metadata: yield* metadataIn(root),\n manifest: yield* readManifest(root),\n };\n const text = yield* encodeCached({ fingerprint: yield* fingerprintOf(root), source });\n yield* files.writeFile(files.join(root, WORKSPACE_CACHE), text);\n return source;\n});\n\nconst workspaceIn = Effect.fn(\"workspaceIn\")(function* workspaceIn(root: string) {\n const cached = yield* cachedSource(root);\n const source = yield* Option.match(cached, {\n onNone: () => readSource(root),\n onSome: Effect.succeed,\n });\n const workspace: CargoWorkspace = {\n ...source,\n ignored: yield* collectIgnoredDirectories(root),\n };\n return workspace;\n});\n\nconst warn = (root: string, reason: string): Effect.Effect<void> =>\n Console.error(\n `msch: the cargo workspace in ${root} could not be read, so its cargo tasks track every file they read: ${reason}`,\n );\n\nconst loaded = (\n root: string,\n): Effect.Effect<Option.Option<CargoWorkspace>, never, Layer.Success<typeof nodeLayer>> =>\n workspaceIn(root).pipe(\n Effect.asSome,\n Effect.catchTag(\"MetadataFailed\", ({ output }) => Effect.fail(output)),\n Effect.tapError((cause) => warn(root, String(cause))),\n Effect.orElseSucceed(() => Option.none<CargoWorkspace>()),\n );\n\nconst loadedOnce = startedOnce<Option.Option<CargoWorkspace>>();\n\nconst loadWorkspace = (root: string): Promise<Option.Option<CargoWorkspace>> =>\n loadedOnce(root, () => Effect.runPromise(loaded(root).pipe(Effect.provide(nodeLayer))));\n\nconst lockDirectory = (\n directory: string,\n): Effect.Effect<Option.Option<string>, never, RepositoryFiles> =>\n Effect.gen(function* findLockDirectory() {\n const files = yield* RepositoryFiles;\n if (yield* files.exists(files.join(directory, LOCK_FILE))) {\n return Option.some(directory);\n }\n const parent = files.dirname(directory);\n if (parent === directory) {\n return Option.none<string>();\n }\n return yield* lockDirectory(parent);\n });\n\nconst writeClosure = Effect.fn(\"writeClosure\")(function* writeClosure(\n root: string,\n derived: DerivedInputs,\n) {\n const files = yield* RepositoryFiles;\n const file = files.join(root, derived.closureFile);\n const written = yield* files.readFile(file);\n if (!Option.exists(written, (text) => text === derived.closure)) {\n yield* files.writeFile(file, derived.closure);\n }\n return derived.inputs;\n});\n\nconst inputsIn = Effect.fn(\"inputsIn\")(function* inputsIn(\n root: string,\n directory: string,\n extras: readonly string[],\n) {\n const workspace = yield* Effect.promise(() => loadWorkspace(root));\n return yield* Option.match(workspace, {\n onNone: () => Effect.succeed(AUTO),\n onSome: (found) => writeClosure(root, cargoInputsOf({ workspace: found, directory, extras })),\n });\n});\n\nconst deriveCargoInputs = Effect.fn(\"deriveCargoInputs\")(function* deriveCargoInputs({\n directory,\n extras = [],\n}: CargoInputOptions) {\n const files = yield* RepositoryFiles;\n const absolute = files.resolve(directory);\n const root = yield* lockDirectory(absolute);\n return yield* Option.match(root, {\n onNone: () => Effect.succeed(AUTO),\n onSome: (found) => inputsIn(found, absolute, extras),\n });\n});\n\nexport const cargoInputs = (options: CargoInputOptions): Promise<readonly CargoInput[]> =>\n Effect.runPromise(deriveCargoInputs(options).pipe(Effect.provide(nodeLayer)));\n"],"mappings":";;;;;;;AAKA,MAAa,YAAY;AACzB,MAAa,gBAAgB;AAC7B,MAAa,kBAAkB;AAC/B,MAAM,eAAe;AAErB,MAAM,mBAAmB,OAAO,OAAO;CACrC,SAAS,OAAO;CAChB,MAAM,OAAO,QAAQ,WAAW;AAClC,CAAC;AACD,MAAM,qBAAqB,OAAO,OAAO;CACvC,IAAI,OAAO;CACX,MAAM,OAAO;CACb,eAAe,OAAO;CACtB,QAAQ,OAAO,OAAO,OAAO,MAAM;AACrC,CAAC;AACD,MAAM,YAAY,OAAO,OAAO;CAC9B,IAAI,OAAO;CACX,MAAM,OAAO,MAAM,OAAO,OAAO,EAAE,KAAK,OAAO,OAAO,CAAC,CAAC;AAC1D,CAAC;AACD,MAAa,sBAAsB,OAAO,OAAO;CAC/C,UAAU,OAAO,MAAM,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CACjE,OAAO,OAAO,OAAO,MAAM,WAAW;EACpC,cAAc,OAAO,QAAQ,IAAI;EACjC,SAAS,UAAU,aAAa,MAAM,cAAc;GAAE,WAAW;GAAO;GAAW;EAAO,CAAC,CAAC;CAC9F,CAAC;AACH,CAAC;AAED,MAAM,oBAAoB,OAAO,GAAG,mBAAmB,CAAC,CAAC,UAAU,kBAAkB,EACnF,WACA,SAAS,CAAC,KACU;CAEpB,MAAM,YAAW,OADI,gBAAA,CACE,QAAQ,SAAS;CACxC,MAAM,OAAO,OAAO,cAAc,QAAQ;CAC1C,OAAO,OAAO,OAAO,MAAM,MAAM;EAC/B,cAAc,OAAO,QAAQ,IAAI;EACjC,SAAS,UAAU,SAAS,OAAO,UAAU,MAAM;CACrD,CAAC;AACH,CAAC;AAED,MAAa,eAAe,YAC1B,OAAO,WAAW,kBAAkB,OAAO,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/changed.mjs
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as ProblemsFound, t as runCli } from "./runtime-GbrDfB8K.mjs";
|
|
3
|
+
import { a as installedPackages, i as recordsIn, r as keepOnly, s as workspaceClosure } from "./project-DeQcAglt.mjs";
|
|
4
|
+
import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-aXwrITdF.mjs";
|
|
5
|
+
import { v as workspaceDirectories } from "./dependencies-v59cxwTD.mjs";
|
|
6
|
+
import { Array, Effect, Option, Order, Record, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
7
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
8
|
+
// src/features/run-changed/model/records.ts
|
|
9
|
+
const RECORDS = [
|
|
10
|
+
NODE_MODULES,
|
|
11
|
+
".cache",
|
|
12
|
+
"msch",
|
|
13
|
+
"changed"
|
|
14
|
+
];
|
|
15
|
+
const ARGUMENT_SEPARATOR$1 = "\0";
|
|
16
|
+
const recordsOf = Effect.fn("recordsOf")(function* recordsOf(root, command) {
|
|
17
|
+
const files = yield* RepositoryFiles;
|
|
18
|
+
const name = yield* files.hash(Array.join(command, ARGUMENT_SEPARATOR$1));
|
|
19
|
+
return yield* recordsIn(files.join(root, ...RECORDS, name));
|
|
20
|
+
});
|
|
21
|
+
// src/features/run-changed/model/units.ts
|
|
22
|
+
const SEPARATOR = "/";
|
|
23
|
+
const FIELD_SEPARATOR = "\0";
|
|
24
|
+
const LINE_SEPARATOR = "\n";
|
|
25
|
+
const EMPTY = "";
|
|
26
|
+
const READ_CONCURRENCY = 16;
|
|
27
|
+
const SHARED_CONFIG = /^(?:[^/]+\.config\.[cm]?[jt]s|tsconfig(?:\.[^/]+)?\.json|\.gitignore)$/u;
|
|
28
|
+
const memberOf = (names) => (file) => pipe(names, Array.findFirst((name) => String$1.startsWith(`${name}${SEPARATOR}`)(file)), Option.getOrElse(() => "."));
|
|
29
|
+
const entryOf = ([file, digest]) => `${file}${FIELD_SEPARATOR}${digest}`;
|
|
30
|
+
const digested = Effect.fn("digested")(function* digested(root, file) {
|
|
31
|
+
const files = yield* RepositoryFiles;
|
|
32
|
+
const digest = yield* files.hashFile(files.join(root, file));
|
|
33
|
+
return [file, Option.getOrElse(digest, () => EMPTY)];
|
|
34
|
+
});
|
|
35
|
+
const hashed = (lines) => Effect.gen(function* hashLines() {
|
|
36
|
+
return yield* (yield* RepositoryFiles).hash(Array.join(lines, LINE_SEPARATOR));
|
|
37
|
+
});
|
|
38
|
+
const ownedBy = (listing, name) => Option.getOrElse(Record.get(listing.owned, name), () => []);
|
|
39
|
+
const entriesIn = (listing, name) => pipe(ownedBy(listing, name), Array.map(entryOf));
|
|
40
|
+
const closureOf = Effect.fn("closureOf")(function* closureOf(root, name) {
|
|
41
|
+
const files = yield* RepositoryFiles;
|
|
42
|
+
const directories = yield* workspaceClosure(files.join(root, name));
|
|
43
|
+
const names = pipe(directories, Array.map((directory) => files.relative(root, directory)), Array.filter(String$1.isNonEmpty));
|
|
44
|
+
return Array.sort(names, Order.String);
|
|
45
|
+
});
|
|
46
|
+
const memberIn = (listing) => (name) => Effect.gen(function* readMember() {
|
|
47
|
+
const files = yield* RepositoryFiles;
|
|
48
|
+
return {
|
|
49
|
+
name,
|
|
50
|
+
digest: yield* hashed(entriesIn(listing, name)),
|
|
51
|
+
installed: yield* installedPackages(listing.root, files.join(listing.root, name)),
|
|
52
|
+
closure: yield* closureOf(listing.root, name)
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const reached = (members) => (closure) => pipe(members, Array.filter(({ name }) => Array.contains(closure, name)));
|
|
56
|
+
const linesOf = (found) => {
|
|
57
|
+
const installed = pipe(found, Array.flatMap((member) => member.installed), Array.dedupe);
|
|
58
|
+
const digests = pipe(found, Array.map(({ name, digest }) => entryOf([name, digest])));
|
|
59
|
+
return [...Array.sort(installed, Order.String), ...digests];
|
|
60
|
+
};
|
|
61
|
+
const sharedKey = Effect.fn("sharedKey")(function* sharedKey(listing, members) {
|
|
62
|
+
const installed = yield* installedPackages(listing.root, listing.root);
|
|
63
|
+
const closure = yield* closureOf(listing.root, EMPTY);
|
|
64
|
+
const config = pipe(ownedBy(listing, "."), Array.filter(([file]) => SHARED_CONFIG.test(file)), Array.map(entryOf));
|
|
65
|
+
return yield* hashed([
|
|
66
|
+
...installed,
|
|
67
|
+
...config,
|
|
68
|
+
...linesOf(reached(members)(closure))
|
|
69
|
+
]);
|
|
70
|
+
});
|
|
71
|
+
const rootPaths = (listing) => pipe(ownedBy(listing, "."), Array.map(([file]) => file), Array.map((file) => {
|
|
72
|
+
const [top] = String$1.split(file, SEPARATOR);
|
|
73
|
+
if (pipe(listing.names, Array.some((name) => String$1.startsWith(`${top}${SEPARATOR}`)(name)))) return file;
|
|
74
|
+
return top;
|
|
75
|
+
}), Array.dedupe);
|
|
76
|
+
const rootUnit = Effect.fn("rootUnit")(function* rootUnit(listing, shared) {
|
|
77
|
+
const key = yield* hashed([
|
|
78
|
+
shared,
|
|
79
|
+
".",
|
|
80
|
+
...entriesIn(listing, ".")
|
|
81
|
+
]);
|
|
82
|
+
return {
|
|
83
|
+
name: ".",
|
|
84
|
+
paths: rootPaths(listing),
|
|
85
|
+
key
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const memberUnit = (shared, members) => (member) => hashed([
|
|
89
|
+
shared,
|
|
90
|
+
member.name,
|
|
91
|
+
...linesOf(reached(members)(member.closure))
|
|
92
|
+
]).pipe(Effect.map((key) => ({
|
|
93
|
+
name: member.name,
|
|
94
|
+
paths: [member.name],
|
|
95
|
+
key
|
|
96
|
+
})));
|
|
97
|
+
const unitsOf = Effect.fn("unitsOf")(function* unitsOf(root) {
|
|
98
|
+
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
99
|
+
const names = yield* workspaceDirectories(root);
|
|
100
|
+
const entries = yield* Effect.forEach(listed, (file) => digested(root, file), { concurrency: READ_CONCURRENCY });
|
|
101
|
+
const listing = {
|
|
102
|
+
root,
|
|
103
|
+
names,
|
|
104
|
+
owned: Array.groupBy(entries, ([file]) => memberOf(names)(file))
|
|
105
|
+
};
|
|
106
|
+
const members = yield* Effect.forEach(names, memberIn(listing), { concurrency: READ_CONCURRENCY });
|
|
107
|
+
const shared = yield* sharedKey(listing, members);
|
|
108
|
+
const units = yield* Effect.forEach(members, memberUnit(shared, members), { concurrency: 1 });
|
|
109
|
+
return [yield* rootUnit(listing, shared), ...units];
|
|
110
|
+
});
|
|
111
|
+
// src/features/run-changed/model/run.ts
|
|
112
|
+
const SUCCESS$1 = 0;
|
|
113
|
+
const LIST_SEPARATOR = ", ";
|
|
114
|
+
const ARGUMENT_SEPARATOR = " ";
|
|
115
|
+
const EVERYTHING = "everything";
|
|
116
|
+
const report = Effect.fn("report")(function* report(text) {
|
|
117
|
+
const stdio = yield* Stdio.Stdio;
|
|
118
|
+
yield* Stream.make(`msch-changed: ${text}\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);
|
|
119
|
+
});
|
|
120
|
+
const pathsOf = (units, changed) => {
|
|
121
|
+
if (changed.length === units.length) return [];
|
|
122
|
+
return pipe(changed, Array.flatMap(({ paths }) => paths));
|
|
123
|
+
};
|
|
124
|
+
const namesOf = (units, changed) => {
|
|
125
|
+
if (changed.length === units.length) return EVERYTHING;
|
|
126
|
+
return pipe(changed, Array.map(({ name }) => name), Array.join(LIST_SEPARATOR));
|
|
127
|
+
};
|
|
128
|
+
const exitCodeOf = Effect.fn("exitCodeOf")(function* exitCodeOf(root, [command, ...args]) {
|
|
129
|
+
const code = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).exitCode(ChildProcess.make(command, args, {
|
|
130
|
+
cwd: root,
|
|
131
|
+
extendEnv: true,
|
|
132
|
+
stdin: "ignore",
|
|
133
|
+
stdout: "inherit",
|
|
134
|
+
stderr: "inherit"
|
|
135
|
+
}));
|
|
136
|
+
return Number(code);
|
|
137
|
+
});
|
|
138
|
+
const passedAll = (units) => pipe(units, Array.map(({ key }) => key));
|
|
139
|
+
const ran = Effect.fn("ran")(function* ran(root, command, plan) {
|
|
140
|
+
const code = yield* exitCodeOf(root, [...command, ...pathsOf(plan.units, plan.changed)]);
|
|
141
|
+
yield* Effect.when(keepOnly(plan.records, passedAll(plan.units)), Effect.succeed(code === SUCCESS$1));
|
|
142
|
+
return code;
|
|
143
|
+
});
|
|
144
|
+
/** @internal */
|
|
145
|
+
const runChanged = Effect.fn("runChanged")(function* runChanged(root, command) {
|
|
146
|
+
const units = yield* unitsOf(root);
|
|
147
|
+
const records = yield* recordsOf(root, command);
|
|
148
|
+
const changed = pipe(units, Array.filter(({ key }) => !Array.contains(records.passed, key)));
|
|
149
|
+
const since = `since \`${Array.join(command, ARGUMENT_SEPARATOR)}\` last passed`;
|
|
150
|
+
if (!Array.isReadonlyArrayNonEmpty(changed)) {
|
|
151
|
+
yield* report(`nothing changed ${since}`);
|
|
152
|
+
return SUCCESS$1;
|
|
153
|
+
}
|
|
154
|
+
yield* report(`${String(changed.length)} of ${String(units.length)} changed ${since}: ${namesOf(units, changed)}`);
|
|
155
|
+
return yield* ran(root, command, {
|
|
156
|
+
units,
|
|
157
|
+
changed,
|
|
158
|
+
records
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
// bin/msch-changed.ts
|
|
162
|
+
const SUCCESS = 0;
|
|
163
|
+
const ONE_FAILURE = 1;
|
|
164
|
+
const USAGE = "usage: msch-changed <command> [arguments]. Runs the command with the paths of the workspaces whose inputs changed since it last passed.";
|
|
165
|
+
const taggedError = Schema.TaggedError;
|
|
166
|
+
var UsageError = class extends taggedError()("UsageError", { message: Schema.String }) {};
|
|
167
|
+
const changed = Effect.gen(function* changed() {
|
|
168
|
+
const stdio = yield* Stdio.Stdio;
|
|
169
|
+
const files = yield* RepositoryFiles;
|
|
170
|
+
const args = yield* stdio.args;
|
|
171
|
+
if (!Array.isReadonlyArrayNonEmpty(args)) return yield* UsageError.make({ message: USAGE });
|
|
172
|
+
if ((yield* runChanged(files.resolve("."), args)) !== SUCCESS) return yield* ProblemsFound.make({ count: ONE_FAILURE });
|
|
173
|
+
return yield* Effect.void;
|
|
174
|
+
});
|
|
175
|
+
runCli(changed);
|
|
176
|
+
export {};
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=changed.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changed.mjs","names":["ARGUMENT_SEPARATOR","Arr","Arr","Str","Rec","SUCCESS","Arr","Arr"],"sources":["../src/features/run-changed/model/records.ts","../src/features/run-changed/model/units.ts","../src/features/run-changed/model/run.ts","../bin/msch-changed.ts"],"sourcesContent":["import { Array as Arr, Effect } from \"effect\";\n\nimport { recordsIn } from \"#/shared/lib/pass-records.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RECORDS = [NODE_MODULES, \".cache\", \"msch\", \"changed\"] as const;\nconst ARGUMENT_SEPARATOR = \"\\0\";\n\nexport const recordsOf = Effect.fn(\"recordsOf\")(function* recordsOf(\n root: string,\n command: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const name = yield* files.hash(Arr.join(command, ARGUMENT_SEPARATOR));\n return yield* recordsIn(files.join(root, ...RECORDS, name));\n});\n","import { Array as Arr, Effect, Option, Order, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport { installedPackages, workspaceClosure } from \"#/entities/project/index.ts\";\nimport { workspaceDirectories } from \"#/entities/workspace/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst SEPARATOR = \"/\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\nconst EMPTY = \"\";\nconst READ_CONCURRENCY = 16;\nconst SHARED_CONFIG = /^(?:[^/]+\\.config\\.[cm]?[jt]s|tsconfig(?:\\.[^/]+)?\\.json|\\.gitignore)$/u;\n\nexport const ROOT_UNIT = \".\";\n\nexport interface Unit {\n readonly name: string;\n readonly paths: readonly string[];\n readonly key: string;\n}\n\ninterface Member {\n readonly name: string;\n readonly digest: string;\n readonly installed: readonly string[];\n readonly closure: readonly string[];\n}\n\ntype Entry = readonly [file: string, digest: string];\n\ninterface Listing {\n readonly root: string;\n readonly names: readonly string[];\n readonly owned: Readonly<Record<string, readonly Entry[]>>;\n}\n\nconst memberOf =\n (names: readonly string[]) =>\n (file: string): string =>\n pipe(\n names,\n Arr.findFirst((name) => Str.startsWith(`${name}${SEPARATOR}`)(file)),\n Option.getOrElse(() => ROOT_UNIT),\n );\n\nconst entryOf = ([file, digest]: Entry): string => `${file}${FIELD_SEPARATOR}${digest}`;\n\nconst digested = Effect.fn(\"digested\")(function* digested(root: string, file: string) {\n const files = yield* RepositoryFiles;\n const digest = yield* files.hashFile(files.join(root, file));\n return [file, Option.getOrElse(digest, () => EMPTY)] as const;\n});\n\nconst hashed = (lines: readonly string[]): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* hashLines() {\n const files = yield* RepositoryFiles;\n return yield* files.hash(Arr.join(lines, LINE_SEPARATOR));\n });\n\nconst ownedBy = (listing: Listing, name: string): readonly Entry[] =>\n Option.getOrElse(Rec.get(listing.owned, name), (): readonly Entry[] => []);\n\nconst entriesIn = (listing: Listing, name: string): readonly string[] =>\n pipe(ownedBy(listing, name), Arr.map(entryOf));\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, name: string) {\n const files = yield* RepositoryFiles;\n const directories = yield* workspaceClosure(files.join(root, name));\n const names = pipe(\n directories,\n Arr.map((directory) => files.relative(root, directory)),\n Arr.filter(Str.isNonEmpty),\n );\n return Arr.sort(names, Order.String);\n});\n\nconst memberIn =\n (listing: Listing) =>\n (name: string): Effect.Effect<Member, never, RepositoryFiles> =>\n Effect.gen(function* readMember() {\n const files = yield* RepositoryFiles;\n return {\n name,\n digest: yield* hashed(entriesIn(listing, name)),\n installed: yield* installedPackages(listing.root, files.join(listing.root, name)),\n closure: yield* closureOf(listing.root, name),\n };\n });\n\nconst reached =\n (members: readonly Member[]) =>\n (closure: readonly string[]): readonly Member[] =>\n pipe(\n members,\n Arr.filter(({ name }) => Arr.contains(closure, name)),\n );\n\nconst linesOf = (found: readonly Member[]): readonly string[] => {\n const installed = pipe(\n found,\n Arr.flatMap((member) => member.installed),\n Arr.dedupe,\n );\n const digests = pipe(\n found,\n Arr.map(({ name, digest }) => entryOf([name, digest])),\n );\n return [...Arr.sort(installed, Order.String), ...digests];\n};\n\nconst sharedKey = Effect.fn(\"sharedKey\")(function* sharedKey(\n listing: Listing,\n members: readonly Member[],\n) {\n const installed = yield* installedPackages(listing.root, listing.root);\n const closure = yield* closureOf(listing.root, EMPTY);\n const config = pipe(\n ownedBy(listing, ROOT_UNIT),\n Arr.filter(([file]) => SHARED_CONFIG.test(file)),\n Arr.map(entryOf),\n );\n return yield* hashed([...installed, ...config, ...linesOf(reached(members)(closure))]);\n});\n\nconst rootPaths = (listing: Listing): readonly string[] =>\n pipe(\n ownedBy(listing, ROOT_UNIT),\n Arr.map(([file]) => file),\n Arr.map((file) => {\n const [top] = Str.split(file, SEPARATOR);\n const holdsMembers = pipe(\n listing.names,\n Arr.some((name) => Str.startsWith(`${top}${SEPARATOR}`)(name)),\n );\n if (holdsMembers) {\n return file;\n }\n return top;\n }),\n Arr.dedupe,\n );\n\nconst rootUnit = Effect.fn(\"rootUnit\")(function* rootUnit(listing: Listing, shared: string) {\n const key = yield* hashed([shared, ROOT_UNIT, ...entriesIn(listing, ROOT_UNIT)]);\n return { name: ROOT_UNIT, paths: rootPaths(listing), key } satisfies Unit;\n});\n\nconst memberUnit =\n (shared: string, members: readonly Member[]) =>\n (member: Member): Effect.Effect<Unit, never, RepositoryFiles> =>\n hashed([shared, member.name, ...linesOf(reached(members)(member.closure))]).pipe(\n Effect.map((key) => ({ name: member.name, paths: [member.name], key })),\n );\n\nexport const unitsOf = Effect.fn(\"unitsOf\")(function* unitsOf(root: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.listedFiles(root);\n const names = yield* workspaceDirectories(root);\n const entries = yield* Effect.forEach(listed, (file) => digested(root, file), {\n concurrency: READ_CONCURRENCY,\n });\n const owned = Arr.groupBy(entries, ([file]) => memberOf(names)(file));\n const listing: Listing = { root, names, owned };\n const members = yield* Effect.forEach(names, memberIn(listing), {\n concurrency: READ_CONCURRENCY,\n });\n const shared = yield* sharedKey(listing, members);\n const units = yield* Effect.forEach(members, memberUnit(shared, members), { concurrency: 1 });\n return [yield* rootUnit(listing, shared), ...units];\n});\n","import { Array as Arr, Effect, Stdio, Stream, pipe } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { keepOnly } from \"#/shared/lib/pass-records.ts\";\nimport type { Records } from \"#/shared/lib/pass-records.ts\";\n\nimport { recordsOf } from \"./records.ts\";\nimport { unitsOf } from \"./units.ts\";\nimport type { Unit } from \"./units.ts\";\n\nconst SUCCESS = 0;\nconst LIST_SEPARATOR = \", \";\nconst ARGUMENT_SEPARATOR = \" \";\nconst EVERYTHING = \"everything\";\n\nconst report = Effect.fn(\"report\")(function* report(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(`msch-changed: ${text}\\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n});\n\nconst pathsOf = (units: readonly Unit[], changed: readonly Unit[]): readonly string[] => {\n if (changed.length === units.length) {\n return [];\n }\n return pipe(\n changed,\n Arr.flatMap(({ paths }) => paths),\n );\n};\n\nconst namesOf = (units: readonly Unit[], changed: readonly Unit[]): string => {\n if (changed.length === units.length) {\n return EVERYTHING;\n }\n return pipe(\n changed,\n Arr.map(({ name }) => name),\n Arr.join(LIST_SEPARATOR),\n );\n};\n\nconst exitCodeOf = Effect.fn(\"exitCodeOf\")(function* exitCodeOf(\n root: string,\n [command, ...args]: readonly [string, ...string[]],\n) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const code = yield* spawner.exitCode(\n ChildProcess.make(command, args, {\n cwd: root,\n extendEnv: true,\n stdin: \"ignore\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n return Number(code);\n});\n\nconst passedAll = (units: readonly Unit[]): readonly string[] =>\n pipe(\n units,\n Arr.map(({ key }) => key),\n );\n\ninterface Plan {\n readonly units: readonly Unit[];\n readonly changed: readonly Unit[];\n readonly records: Records;\n}\n\nconst ran = Effect.fn(\"ran\")(function* ran(\n root: string,\n command: readonly [string, ...string[]],\n plan: Plan,\n) {\n const code = yield* exitCodeOf(root, [...command, ...pathsOf(plan.units, plan.changed)]);\n yield* Effect.when(\n keepOnly(plan.records, passedAll(plan.units)),\n Effect.succeed(code === SUCCESS),\n );\n return code;\n});\n\n/** @internal */\nexport const runChanged = Effect.fn(\"runChanged\")(function* runChanged(\n root: string,\n command: readonly [string, ...string[]],\n) {\n const units = yield* unitsOf(root);\n const records = yield* recordsOf(root, command);\n const changed = pipe(\n units,\n Arr.filter(({ key }) => !Arr.contains(records.passed, key)),\n );\n const since = `since \\`${Arr.join(command, ARGUMENT_SEPARATOR)}\\` last passed`;\n if (!Arr.isReadonlyArrayNonEmpty(changed)) {\n yield* report(`nothing changed ${since}`);\n return SUCCESS;\n }\n yield* report(\n `${String(changed.length)} of ${String(units.length)} changed ${since}: ${namesOf(units, changed)}`,\n );\n return yield* ran(root, command, { units, changed, records });\n});\n","#!/usr/bin/env node\nimport { Array as Arr, Effect, Schema, Stdio } from \"effect\";\n\nimport { ProblemsFound } from \"#/app/output.ts\";\nimport { runCli } from \"#/app/runtime.ts\";\nimport { runChanged } from \"#/features/run-changed/index.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst SUCCESS = 0;\nconst ONE_FAILURE = 1;\nconst USAGE =\n \"usage: msch-changed <command> [arguments]. Runs the command with the paths of the workspaces whose inputs changed since it last passed.\";\n\nconst taggedError = Schema.TaggedError;\n\nclass UsageError extends taggedError<UsageError, { readonly brand: unique symbol }>()(\n \"UsageError\",\n { message: Schema.String },\n) {}\n\nconst changed = Effect.gen(function* changed() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n if (!Arr.isReadonlyArrayNonEmpty(args)) {\n return yield* UsageError.make({ message: USAGE });\n }\n const code = yield* runChanged(files.resolve(\".\"), args);\n if (code !== SUCCESS) {\n return yield* ProblemsFound.make({ count: ONE_FAILURE });\n }\n return yield* Effect.void;\n});\n\nrunCli(changed);\n"],"mappings":";;;;;;;;AAKA,MAAM,UAAU;CAAC;CAAc;CAAU;CAAQ;AAAS;AAC1D,MAAMA,uBAAqB;AAE3B,MAAa,YAAY,OAAO,GAAG,WAAW,CAAC,CAAC,UAAU,UACxD,MACA,SACA;CACA,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM,KAAKC,MAAI,KAAK,SAASD,oBAAkB,CAAC;CACpE,OAAO,OAAO,UAAU,MAAM,KAAK,MAAM,GAAG,SAAS,IAAI,CAAC;AAC5D,CAAC;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