@savvy-web/silk-effects 5.1.3 → 5.2.1
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 +22 -22
- package/changesets/api/transformer.js +2 -1
- package/changesets/changelog/getReleaseLine.js +7 -4
- package/changesets/changelog/index.js +8 -6
- package/changesets/index.js +6 -11
- package/changesets/services/branch-analyzer.js +20 -19
- package/changesets/services/changelog.js +1 -1
- package/changesets/services/config-inspector.js +17 -17
- package/changesets/services/deps-regen.js +36 -34
- package/changesets/services/github.js +39 -40
- package/changesets/services/release-planner.js +7 -6
- package/changesets/utils/dependency-table.js +2 -1
- package/changesets/utils/jsonpath.js +5 -7
- package/changesets/utils/publishability.js +2 -2
- package/commitlint/detection/dco.js +2 -1
- package/commitlint/index.js +2 -1
- package/index.d.ts +224 -213
- package/index.js +7 -7
- package/lint/handlers/PnpmWorkspace.js +2 -1
- package/lint/handlers/Yaml.js +8 -4
- package/package.json +10 -10
- package/repos/index.js +3 -5
- package/repos/services/config-store.js +68 -67
- package/repos/services/manager.js +259 -258
- package/services/BiomeSchemaSync.js +65 -64
- package/services/ChangesetConfig.js +50 -50
- package/services/ChangesetConfigReader.js +59 -58
- package/services/ConfigDiscovery.js +42 -41
- package/services/SilkPublishability.js +54 -53
- package/services/SilkWorkspaceAnalyzer.js +110 -109
- package/turbo/index.js +2 -3
- package/turbo/services/TurboInspector.js +80 -79
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ All exports come from the package root:
|
|
|
33
33
|
```typescript
|
|
34
34
|
import {
|
|
35
35
|
SilkPublishability,
|
|
36
|
-
ChangesetConfig,
|
|
36
|
+
ChangesetConfig,
|
|
37
37
|
Changesets, Lint, Turbo,
|
|
38
38
|
} from "@savvy-web/silk-effects";
|
|
39
39
|
```
|
|
@@ -124,25 +124,25 @@ const messages = Changesets.ChangesetLinter.validateFile(".changeset/quiet-moons
|
|
|
124
124
|
|
|
125
125
|
These services read or write files. Provide the platform layer for your runtime, such as `NodeServices.layer`.
|
|
126
126
|
|
|
127
|
-
####
|
|
127
|
+
#### SilkPublishability.layer and SilkPublishability.layerAdaptive
|
|
128
128
|
|
|
129
|
-
`SilkPublishability.detect` is also exposed through `@effected/workspaces`'s `PublishabilityDetector` Tag so consumers can swap silk rules into any program that already yields the detector. Two layers override the Tag:
|
|
129
|
+
`SilkPublishability.detect` is also exposed through `@effected/workspaces`'s `PublishabilityDetector` Tag so consumers can swap silk rules into any program that already yields the detector. Two static layers override the Tag:
|
|
130
130
|
|
|
131
|
-
- `
|
|
132
|
-
- `
|
|
131
|
+
- `SilkPublishability.layer` — applies silk rules unconditionally. Requires `FileSystem`.
|
|
132
|
+
- `SilkPublishability.layerAdaptive` — ignore-aware. Changeset-`ignore`d packages resolve to `[]`, then it dispatches by changeset mode (`none` → `[]`, `silk` → silk rules, `vanilla` → the `@effected/workspaces` default). Requires `FileSystem` and `ChangesetConfig`.
|
|
133
133
|
|
|
134
134
|
```typescript
|
|
135
135
|
import { Effect } from "effect";
|
|
136
136
|
import { NodeServices } from "@effect/platform-node";
|
|
137
137
|
import { PublishabilityDetector } from "@effected/workspaces";
|
|
138
|
-
import {
|
|
138
|
+
import { SilkPublishability } from "@savvy-web/silk-effects";
|
|
139
139
|
|
|
140
140
|
const targets = await Effect.runPromise(
|
|
141
141
|
Effect.gen(function* () {
|
|
142
142
|
const detector = yield* PublishabilityDetector;
|
|
143
143
|
return yield* detector.detect(pkg, root);
|
|
144
144
|
}).pipe(
|
|
145
|
-
Effect.provide(
|
|
145
|
+
Effect.provide(SilkPublishability.layer),
|
|
146
146
|
Effect.provide(NodeServices.layer),
|
|
147
147
|
),
|
|
148
148
|
);
|
|
@@ -159,7 +159,7 @@ Typed accessor over a workspace root's `.changeset/config.json`, reading through
|
|
|
159
159
|
import { Effect } from "effect";
|
|
160
160
|
import { NodeServices } from "@effect/platform-node";
|
|
161
161
|
import {
|
|
162
|
-
ChangesetConfig,
|
|
162
|
+
ChangesetConfig, ChangesetConfigReader,
|
|
163
163
|
} from "@savvy-web/silk-effects";
|
|
164
164
|
|
|
165
165
|
const mode = await Effect.runPromise(
|
|
@@ -167,8 +167,8 @@ const mode = await Effect.runPromise(
|
|
|
167
167
|
const config = yield* ChangesetConfig;
|
|
168
168
|
return yield* config.mode(process.cwd());
|
|
169
169
|
}).pipe(
|
|
170
|
-
Effect.provide(
|
|
171
|
-
Effect.provide(
|
|
170
|
+
Effect.provide(ChangesetConfig.layer),
|
|
171
|
+
Effect.provide(ChangesetConfigReader.layer),
|
|
172
172
|
Effect.provide(NodeServices.layer),
|
|
173
173
|
),
|
|
174
174
|
);
|
|
@@ -212,7 +212,7 @@ Read and decode `.changeset/config.json`. Auto-detects whether the project uses
|
|
|
212
212
|
import { Effect } from "effect";
|
|
213
213
|
import { NodeServices } from "@effect/platform-node";
|
|
214
214
|
import {
|
|
215
|
-
ChangesetConfigReader,
|
|
215
|
+
ChangesetConfigReader,
|
|
216
216
|
} from "@savvy-web/silk-effects";
|
|
217
217
|
|
|
218
218
|
const config = await Effect.runPromise(
|
|
@@ -220,7 +220,7 @@ const config = await Effect.runPromise(
|
|
|
220
220
|
const reader = yield* ChangesetConfigReader;
|
|
221
221
|
return yield* reader.read(process.cwd());
|
|
222
222
|
}).pipe(
|
|
223
|
-
Effect.provide(
|
|
223
|
+
Effect.provide(ChangesetConfigReader.layer),
|
|
224
224
|
Effect.provide(NodeServices.layer),
|
|
225
225
|
),
|
|
226
226
|
);
|
|
@@ -234,14 +234,14 @@ Locate config files using a priority-based search convention. Checks `lib/config
|
|
|
234
234
|
```typescript
|
|
235
235
|
import { Effect } from "effect";
|
|
236
236
|
import { NodeServices } from "@effect/platform-node";
|
|
237
|
-
import { ConfigDiscovery
|
|
237
|
+
import { ConfigDiscovery } from "@savvy-web/silk-effects";
|
|
238
238
|
|
|
239
239
|
const result = await Effect.runPromise(
|
|
240
240
|
Effect.gen(function* () {
|
|
241
241
|
const cd = yield* ConfigDiscovery;
|
|
242
242
|
return yield* cd.find("biome.jsonc");
|
|
243
243
|
}).pipe(
|
|
244
|
-
Effect.provide(
|
|
244
|
+
Effect.provide(ConfigDiscovery.layer),
|
|
245
245
|
Effect.provide(NodeServices.layer),
|
|
246
246
|
),
|
|
247
247
|
);
|
|
@@ -255,14 +255,14 @@ Keep Biome config `$schema` URLs current. Locates `biome.json` or `biome.jsonc`,
|
|
|
255
255
|
```typescript
|
|
256
256
|
import { Effect } from "effect";
|
|
257
257
|
import { NodeServices } from "@effect/platform-node";
|
|
258
|
-
import { BiomeSchemaSync
|
|
258
|
+
import { BiomeSchemaSync } from "@savvy-web/silk-effects";
|
|
259
259
|
|
|
260
260
|
const result = await Effect.runPromise(
|
|
261
261
|
Effect.gen(function* () {
|
|
262
262
|
const bss = yield* BiomeSchemaSync;
|
|
263
263
|
return yield* bss.sync("2.0.0");
|
|
264
264
|
}).pipe(
|
|
265
|
-
Effect.provide(
|
|
265
|
+
Effect.provide(BiomeSchemaSync.layer),
|
|
266
266
|
Effect.provide(NodeServices.layer),
|
|
267
267
|
),
|
|
268
268
|
);
|
|
@@ -273,7 +273,7 @@ const result = await Effect.runPromise(
|
|
|
273
273
|
|
|
274
274
|
Resolve `.changeset/config.json` into a fully attributed view of the workspace: the configured changelog, base branch, access and ignore list, plus one scope per package carrying its `workspaceDir`, version, `additionalScopes` and resolved `versionFiles`. `inspect(cwd)` returns that view and `classify` maps arbitrary file paths to the package that owns them, which is how a branch diff becomes a per-package attribution. `refresh()` clears the per-root cache, which a long-lived host needs in order to see config edits made between calls.
|
|
275
275
|
|
|
276
|
-
`Changesets.
|
|
276
|
+
`Changesets.ConfigInspector.layer` requires `ChangesetConfigReader`, `WorkspaceDiscovery` from [`@effected/workspaces`](https://www.npmjs.com/package/@effected/workspaces) and `FileSystem`.
|
|
277
277
|
|
|
278
278
|
#### ReleasePlanner
|
|
279
279
|
|
|
@@ -292,7 +292,7 @@ const preview = yield* planner.preview(root, {
|
|
|
292
292
|
// => ChangesetPreview: per-release changelogEntry, versions and changeset ids
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
`Changesets.
|
|
295
|
+
`Changesets.ReleasePlanner.layer` requires `ConfigInspector` and `FileSystem`.
|
|
296
296
|
|
|
297
297
|
---
|
|
298
298
|
|
|
@@ -302,7 +302,7 @@ const preview = yield* planner.preview(root, {
|
|
|
302
302
|
|
|
303
303
|
`analyzeBranch` classifies a branch's diff by the package that owns each file, applying `ConfigInspector` attribution over the git range. This is what answers "what changed on this branch, and which package releases because of it", including the unmapped files that belong to no package.
|
|
304
304
|
|
|
305
|
-
`Changesets.
|
|
305
|
+
`Changesets.BranchAnalyzer.layer` requires `ConfigInspector` and the platform process spawner.
|
|
306
306
|
|
|
307
307
|
#### DepsRegen
|
|
308
308
|
|
|
@@ -329,13 +329,13 @@ const plan = await Effect.runPromise(
|
|
|
329
329
|
// => RegenPlan: files to write, rows per package, changesets to delete
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
-
`Changesets.
|
|
332
|
+
`Changesets.DepsRegen.layer` is the seam for callers injecting their own dependencies; it requires `WorkspaceSnapshots`, `ConfigInspector`, `WorkspaceDiscovery`, `PublishabilityDetector`, `ChangesetConfig`, `Git` and `FileSystem`.
|
|
333
333
|
|
|
334
334
|
#### TurboInspector
|
|
335
335
|
|
|
336
336
|
Read-only Turborepo inspection. Every method shells out to `turbo` with `--dry=json`, so no task ever runs. `diagnoseCache(task, cwd)` reports a per-package cache HIT/MISS breakdown for a task, `taskGraph(cwd, task?)` derives the task graph and its critical path and `affected(cwd, base?)` lists the packages affected relative to `base` (default `main`). It resolves the `turbo` binary through `ToolDiscovery` from [`@effected/commands`](https://www.npmjs.com/package/@effected/commands) and fails with a tagged error when `turbo` is missing or the directory is not a Turborepo. The service tag and its layer are exported under the `Turbo` namespace.
|
|
337
337
|
|
|
338
|
-
`Turbo.
|
|
338
|
+
`Turbo.TurboInspector.layer` requires `ToolDiscovery`, `Git` from [`@effected/git`](https://www.npmjs.com/package/@effected/git), `FileSystem` and the platform process spawner. Wire `ToolDiscovery` to the workspace with `Workspaces.localExecLayer()`, which teaches it the argv prefix that runs a project-local binary:
|
|
339
339
|
|
|
340
340
|
```typescript
|
|
341
341
|
import { Effect, Layer } from "effect";
|
|
@@ -356,7 +356,7 @@ const diagnosis = await Effect.runPromise(
|
|
|
356
356
|
const turbo = yield* Turbo.TurboInspector;
|
|
357
357
|
return yield* turbo.diagnoseCache("build:dev", process.cwd());
|
|
358
358
|
}).pipe(
|
|
359
|
-
Effect.provide(Turbo.
|
|
359
|
+
Effect.provide(Turbo.TurboInspector.layer),
|
|
360
360
|
Effect.provide(Layer.mergeAll(ToolsLive, Git.layer)),
|
|
361
361
|
Effect.provide(NodeServices.layer),
|
|
362
362
|
),
|
|
@@ -126,7 +126,8 @@ var ChangelogTransformer = class ChangelogTransformer {
|
|
|
126
126
|
*/
|
|
127
127
|
static transformFile(filePath, options) {
|
|
128
128
|
const content = readFileSync(filePath, "utf-8");
|
|
129
|
-
|
|
129
|
+
const result = ChangelogTransformer.transformContent(content, options);
|
|
130
|
+
writeFileSync(filePath, result, "utf-8");
|
|
130
131
|
}
|
|
131
132
|
};
|
|
132
133
|
|
|
@@ -84,7 +84,8 @@ function getReleaseLine(changeset, versionType, options) {
|
|
|
84
84
|
const parsed = parseChangesetSections(changeset.summary);
|
|
85
85
|
const firstLine = changeset.summary.split("\n")[0];
|
|
86
86
|
const commitMsg = parseCommitMessage(firstLine);
|
|
87
|
-
const
|
|
87
|
+
const bodyText = changeset.summary.split("\n").slice(1).join("\n");
|
|
88
|
+
const issueRefs = parseIssueReferences(bodyText);
|
|
88
89
|
const attribution = commitInfo ? formatPRAndUserAttribution(commitInfo.pull ?? void 0, commitInfo.user ?? void 0, commitInfo.links) : "";
|
|
89
90
|
if (parsed.sections.length > 0) {
|
|
90
91
|
const lines = [];
|
|
@@ -110,11 +111,13 @@ function getReleaseLine(changeset, versionType, options) {
|
|
|
110
111
|
}
|
|
111
112
|
return `${lines.join("\n").trimEnd()}${attribution}`;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
const commitType = commitMsg.type ?? versionType;
|
|
115
|
+
const entryInput = {
|
|
116
|
+
type: resolveCommitType(commitType, commitMsg.scope, commitMsg.breaking).heading,
|
|
115
117
|
summary: changeset.summary,
|
|
116
118
|
issues: issueRefs
|
|
117
|
-
}
|
|
119
|
+
};
|
|
120
|
+
return `- ${formatChangelogEntry(entryInput, { repo: options.repo })}${attribution}`;
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
123
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateChangesetOptions } from "../schemas/options.js";
|
|
2
|
-
import {
|
|
2
|
+
import { GitHubService } from "../services/github.js";
|
|
3
3
|
import { getDependencyReleaseLine } from "./getDependencyReleaseLine.js";
|
|
4
4
|
import { getReleaseLine } from "./getReleaseLine.js";
|
|
5
5
|
import { Effect } from "effect";
|
|
@@ -16,7 +16,7 @@ import { Effect } from "effect";
|
|
|
16
16
|
* @remarks
|
|
17
17
|
* The module composes two Effect programs — {@link getReleaseLine} and
|
|
18
18
|
* {@link getDependencyReleaseLine} — and runs each through
|
|
19
|
-
* `Effect.runPromise` with
|
|
19
|
+
* `Effect.runPromise` with `GitHubService.layer` (for commit metadata). Options are
|
|
20
20
|
* validated at the boundary via `validateChangesetOptions` before being
|
|
21
21
|
* passed to the formatters.
|
|
22
22
|
*
|
|
@@ -58,14 +58,14 @@ import { Effect } from "effect";
|
|
|
58
58
|
/**
|
|
59
59
|
* The layer providing every service the formatters need.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
61
|
+
* `GitHubService.layer` satisfies the requirements of both `getReleaseLine` and
|
|
62
62
|
* `getDependencyReleaseLine`, which each need only `GitHubService`. Markdown
|
|
63
63
|
* parsing is not a layer: the formatters call the remark pipeline's
|
|
64
64
|
* `parseMarkdown` / `stringifyMarkdown` functions directly.
|
|
65
65
|
*
|
|
66
66
|
* @internal
|
|
67
67
|
*/
|
|
68
|
-
const MainLayer =
|
|
68
|
+
const MainLayer = GitHubService.layer;
|
|
69
69
|
/**
|
|
70
70
|
* Changesets API `ChangelogFunctions` implementation.
|
|
71
71
|
*
|
|
@@ -79,13 +79,15 @@ const MainLayer = GitHubLive;
|
|
|
79
79
|
const changelogFunctions = {
|
|
80
80
|
getReleaseLine: async (changeset, versionType, options) => {
|
|
81
81
|
const program = Effect.gen(function* () {
|
|
82
|
-
|
|
82
|
+
const opts = yield* validateChangesetOptions(options);
|
|
83
|
+
return yield* getReleaseLine(changeset, versionType, opts);
|
|
83
84
|
});
|
|
84
85
|
return Effect.runPromise(program.pipe(Effect.provide(MainLayer)));
|
|
85
86
|
},
|
|
86
87
|
getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => {
|
|
87
88
|
const program = Effect.gen(function* () {
|
|
88
|
-
|
|
89
|
+
const opts = yield* validateChangesetOptions(options);
|
|
90
|
+
return yield* getDependencyReleaseLine(changesets, dependenciesUpdated, opts);
|
|
89
91
|
});
|
|
90
92
|
return Effect.runPromise(program.pipe(Effect.provide(MainLayer)));
|
|
91
93
|
}
|
package/changesets/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ChangesetIOError, ChangesetValidationError, ConfigurationError, GitErro
|
|
|
4
4
|
import { JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, VersionFileConfigSchema, VersionFilesSchema } from "./schemas/version-files.js";
|
|
5
5
|
import { GlobSchema, PackageScopeSchema, PackagesRecordSchema } from "./schemas/package-scope.js";
|
|
6
6
|
import { ChangesetOptionsSchema, RepoSchema } from "./schemas/options.js";
|
|
7
|
-
import {
|
|
7
|
+
import { GitHubService, makeGitHubTest } from "./services/github.js";
|
|
8
8
|
import { NonEmptyString, PositiveInteger } from "./schemas/primitives.js";
|
|
9
9
|
import { DependencyActionSchema, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, VERSION_RE, VersionOrEmptySchema } from "./schemas/dependency-table.js";
|
|
10
10
|
import { serializeDependencyTableToMarkdown } from "./utils/dependency-table.js";
|
|
@@ -28,16 +28,16 @@ import { NormalizeFormatPlugin } from "./remark/plugins/normalize-format.js";
|
|
|
28
28
|
import { ReorderSectionsPlugin } from "./remark/plugins/reorder-sections.js";
|
|
29
29
|
import { SilkChangesetPreset, SilkChangesetTransformPreset } from "./remark/presets.js";
|
|
30
30
|
import { ChangelogTransformer } from "./api/transformer.js";
|
|
31
|
-
import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector,
|
|
32
|
-
import { BranchAnalysisSchema, BranchAnalyzer,
|
|
31
|
+
import { ClassificationReasonSchema, ClassificationSchema, ConfigInspector, InspectedConfigSchema, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, makeConfigInspectorTest } from "./services/config-inspector.js";
|
|
32
|
+
import { BranchAnalysisSchema, BranchAnalyzer, BranchFileEntrySchema, FileStatusSchema, makeBranchAnalyzerTest } from "./services/branch-analyzer.js";
|
|
33
33
|
import { ChangelogService } from "./services/changelog.js";
|
|
34
34
|
import { computeWorkspaceDependencyDiffs } from "./utils/dep-diff.js";
|
|
35
35
|
import { gitMergeBase } from "./utils/git.js";
|
|
36
36
|
import { listPublishablePackageNames } from "./utils/publishability.js";
|
|
37
|
-
import { DepsRegen, DepsRegenDefault,
|
|
37
|
+
import { DepsRegen, DepsRegenDefault, isPureDependencyChangeset, makeDepsRegenDefault } from "./services/deps-regen.js";
|
|
38
38
|
import { MaintenanceReasonSchema, MaintenanceTriggerSchema, deriveMaintenanceReason } from "./services/maintenance-reason.js";
|
|
39
39
|
import { VersionFiles } from "./utils/version-files.js";
|
|
40
|
-
import { ReleasePlanner,
|
|
40
|
+
import { ReleasePlanner, makeReleasePlannerTest } from "./services/release-planner.js";
|
|
41
41
|
import { SectionCategorySchema } from "./categories/types.js";
|
|
42
42
|
import { CommitHashSchema, VersionTypeSchema } from "./schemas/git.js";
|
|
43
43
|
import { ChangesetSchema, ChangesetSummarySchema, DependencyTypeSchema, DependencyUpdateSchema } from "./schemas/changeset.js";
|
|
@@ -56,7 +56,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
56
56
|
AppliedReleaseSchema: () => AppliedReleaseSchema,
|
|
57
57
|
BranchAnalysisSchema: () => BranchAnalysisSchema,
|
|
58
58
|
BranchAnalyzer: () => BranchAnalyzer,
|
|
59
|
-
BranchAnalyzerLive: () => BranchAnalyzerLive,
|
|
60
59
|
BranchFileEntrySchema: () => BranchFileEntrySchema,
|
|
61
60
|
BumpTypeSchema: () => BumpTypeSchema,
|
|
62
61
|
Categories: () => Categories,
|
|
@@ -74,7 +73,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
74
73
|
ClassificationSchema: () => ClassificationSchema,
|
|
75
74
|
CommitHashSchema: () => CommitHashSchema,
|
|
76
75
|
ConfigInspector: () => ConfigInspector,
|
|
77
|
-
ConfigInspectorLive: () => ConfigInspectorLive,
|
|
78
76
|
ConfigurationError: () => ConfigurationError,
|
|
79
77
|
ContentStructureRule: () => ContentStructureRule,
|
|
80
78
|
ContributorFootnotesPlugin: () => ContributorFootnotesPlugin,
|
|
@@ -89,12 +87,10 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
89
87
|
DependencyUpdateSchema: () => DependencyUpdateSchema,
|
|
90
88
|
DepsRegen: () => DepsRegen,
|
|
91
89
|
DepsRegenDefault: () => DepsRegenDefault,
|
|
92
|
-
DepsRegenLive: () => DepsRegenLive,
|
|
93
90
|
FileStatusSchema: () => FileStatusSchema,
|
|
94
91
|
GitError: () => GitError,
|
|
95
92
|
GitHubApiError: () => GitHubApiError,
|
|
96
93
|
GitHubInfoSchema: () => GitHubInfoSchema,
|
|
97
|
-
GitHubLive: () => GitHubLive,
|
|
98
94
|
GitHubService: () => GitHubService,
|
|
99
95
|
GlobSchema: () => GlobSchema,
|
|
100
96
|
HeadingHierarchyRule: () => HeadingHierarchyRule,
|
|
@@ -123,7 +119,6 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
123
119
|
PreviewReleaseSchema: () => PreviewReleaseSchema,
|
|
124
120
|
ReleasePlanError: () => ReleasePlanError,
|
|
125
121
|
ReleasePlanner: () => ReleasePlanner,
|
|
126
|
-
ReleasePlannerLive: () => ReleasePlannerLive,
|
|
127
122
|
ReorderSectionsPlugin: () => ReorderSectionsPlugin,
|
|
128
123
|
RepoSchema: () => RepoSchema,
|
|
129
124
|
RequiredSectionsRule: () => RequiredSectionsRule,
|
|
@@ -159,4 +154,4 @@ var changesets_exports = /* @__PURE__ */ __exportAll({
|
|
|
159
154
|
});
|
|
160
155
|
|
|
161
156
|
//#endregion
|
|
162
|
-
export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer,
|
|
157
|
+
export { AggregateDependencyTablesPlugin, AppliedReleaseEntrySchema, AppliedReleaseSchema, BranchAnalysisSchema, BranchAnalyzer, BranchFileEntrySchema, BumpTypeSchema, Categories, Changelog, ChangelogService, ChangelogTransformer, ChangesetIOError, ChangesetLinter, ChangesetOptionsSchema, ChangesetPreviewSchema, ChangesetSchema, ChangesetSummarySchema, ChangesetValidationError, ClassificationReasonSchema, ClassificationSchema, CommitHashSchema, ConfigInspector, ConfigurationError, ContentStructureRule, ContributorFootnotesPlugin, DeduplicateItemsPlugin, DependencyActionSchema, DependencyTable, DependencyTableFormatRule, DependencyTableRowSchema, DependencyTableSchema, DependencyTableTypeSchema, DependencyTypeSchema, DependencyUpdateSchema, DepsRegen, DepsRegenDefault, FileStatusSchema, GitError, GitHubApiError, GitHubInfoSchema, GitHubService, GlobSchema, HeadingHierarchyRule, InspectedConfigSchema, IssueLinkRefsPlugin, IssueNumberSchema, JsonPathSchema, LegacyVersionFileConfigSchema, LegacyVersionFilesSchema, MaintenanceNotePlugin, MaintenanceReasonSchema, MaintenanceTriggerSchema, MarkdownParseError, ContentStructureRule$1 as MarkdownlintContentStructureRule, DependencyTableFormatRule$1 as MarkdownlintDependencyTableFormatRule, HeadingHierarchyRule$1 as MarkdownlintHeadingHierarchyRule, RequiredSectionsRule$1 as MarkdownlintRequiredSectionsRule, UncategorizedContentRule$1 as MarkdownlintUncategorizedContentRule, MergeSectionsPlugin, NonEmptyString, NormalizeFormatPlugin, PackageScopeSchema, PackagesRecordSchema, PendingChangesetSchema, PositiveInteger, PreviewReleaseSchema, ReleasePlanError, ReleasePlanner, ReorderSectionsPlugin, RepoSchema, RequiredSectionsRule, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, SectionCategorySchema, SilkChangesetPreset, SilkChangesetTransformPreset, SilkChangesetsRules, UncategorizedContentRule, UrlOrMarkdownLinkSchema, UsernameSchema, VERSION_RE, VersionFileConfigSchema, VersionFileError, VersionFileUpdateRecordSchema, VersionFiles, VersionFilesSchema, VersionOrEmptySchema, VersionTypeSchema, changelogFunctions, changesets_exports, computeWorkspaceDependencyDiffs, deriveMaintenanceReason, gitMergeBase, isPureDependencyChangeset, listPublishablePackageNames, makeBranchAnalyzerTest, makeConfigInspectorTest, makeDepsRegenDefault, makeGitHubTest, makeReleasePlannerTest, serializeDependencyTableToMarkdown };
|
|
@@ -36,7 +36,7 @@ const BranchAnalysisSchema = Schema.Struct({
|
|
|
36
36
|
* @example
|
|
37
37
|
* ```typescript
|
|
38
38
|
* import { Effect } from "effect";
|
|
39
|
-
* import { BranchAnalyzer,
|
|
39
|
+
* import { BranchAnalyzer, ConfigInspector } from "@savvy-web/changesets";
|
|
40
40
|
*
|
|
41
41
|
* const program = Effect.gen(function* () {
|
|
42
42
|
* const analyzer = yield* BranchAnalyzer;
|
|
@@ -46,16 +46,30 @@ const BranchAnalysisSchema = Schema.Struct({
|
|
|
46
46
|
*
|
|
47
47
|
* Effect.runPromise(
|
|
48
48
|
* program.pipe(
|
|
49
|
-
* Effect.provide(
|
|
50
|
-
* Effect.provide(
|
|
51
|
-
* // ... +
|
|
49
|
+
* Effect.provide(BranchAnalyzer.layer),
|
|
50
|
+
* Effect.provide(ConfigInspector.layer),
|
|
51
|
+
* // ... + ChangesetConfigReader.layer + kit workspace layers + NodeServices.layer
|
|
52
52
|
* ),
|
|
53
53
|
* );
|
|
54
54
|
* ```
|
|
55
55
|
*
|
|
56
56
|
* @public
|
|
57
57
|
*/
|
|
58
|
-
var BranchAnalyzer = class extends Context.Service()("BranchAnalyzer") {
|
|
58
|
+
var BranchAnalyzer = class extends Context.Service()("BranchAnalyzer") {
|
|
59
|
+
/**
|
|
60
|
+
* Production layer for {@link BranchAnalyzer}.
|
|
61
|
+
*
|
|
62
|
+
* Requires {@link ConfigInspector} (which in turn requires
|
|
63
|
+
* `ChangesetConfigReader` and `WorkspaceDiscovery`) and a
|
|
64
|
+
* `ChildProcessSpawner` (satisfied by `NodeServices.layer`) for the
|
|
65
|
+
* internally-composed `@effected/git` layer.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
70
|
+
return makeShape(yield* ConfigInspector, yield* Git);
|
|
71
|
+
})).pipe(Layer.provide(Git.layer));
|
|
72
|
+
};
|
|
59
73
|
/**
|
|
60
74
|
* Fold a `@effected/git` typed failure into this package's {@link GitError},
|
|
61
75
|
* preserving the public `ConfigurationError | GitError` error channel.
|
|
@@ -139,19 +153,6 @@ function makeShape(inspector, git) {
|
|
|
139
153
|
return { analyzeBranch };
|
|
140
154
|
}
|
|
141
155
|
/**
|
|
142
|
-
* Live layer for {@link BranchAnalyzer}.
|
|
143
|
-
*
|
|
144
|
-
* Requires {@link ConfigInspector} (which in turn requires
|
|
145
|
-
* `ChangesetConfigReader` and `WorkspaceDiscovery`) and a
|
|
146
|
-
* `ChildProcessSpawner` (satisfied by `NodeServices.layer`) for the
|
|
147
|
-
* internally-composed `@effected/git` layer.
|
|
148
|
-
*
|
|
149
|
-
* @public
|
|
150
|
-
*/
|
|
151
|
-
const BranchAnalyzerLive = Layer.effect(BranchAnalyzer, Effect.gen(function* () {
|
|
152
|
-
return makeShape(yield* ConfigInspector, yield* Git);
|
|
153
|
-
})).pipe(Layer.provide(Git.layer));
|
|
154
|
-
/**
|
|
155
156
|
* Test factory — build a {@link BranchAnalyzer} that returns a fixed
|
|
156
157
|
* {@link BranchAnalysis} for any input.
|
|
157
158
|
*
|
|
@@ -162,4 +163,4 @@ function makeBranchAnalyzerTest(fixed) {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
//#endregion
|
|
165
|
-
export { BranchAnalysisSchema, BranchAnalyzer,
|
|
166
|
+
export { BranchAnalysisSchema, BranchAnalyzer, BranchFileEntrySchema, FileStatusSchema, makeBranchAnalyzerTest };
|
|
@@ -18,7 +18,7 @@ import { Context } from "effect";
|
|
|
18
18
|
* ```typescript
|
|
19
19
|
* import { Effect } from "effect";
|
|
20
20
|
* import type { ChangesetOptions } from "\@savvy-web/changesets";
|
|
21
|
-
* import { ChangelogService
|
|
21
|
+
* import { ChangelogService } from "\@savvy-web/changesets";
|
|
22
22
|
*
|
|
23
23
|
* const program = Effect.gen(function* () {
|
|
24
24
|
* const changelog = yield* ChangelogService;
|
|
@@ -39,7 +39,6 @@ import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
|
39
39
|
* {@link ConfigInspectorShape.classify} calls reuse it.
|
|
40
40
|
*
|
|
41
41
|
* @see {@link ConfigInspector} for the Effect service tag
|
|
42
|
-
* @see {@link ConfigInspectorLive} for the production layer
|
|
43
42
|
*
|
|
44
43
|
*/
|
|
45
44
|
/** A `versionFiles` entry expanded to its absolute target paths. @public */
|
|
@@ -93,7 +92,7 @@ const ClassificationSchema = Schema.Struct({
|
|
|
93
92
|
* @example
|
|
94
93
|
* ```typescript
|
|
95
94
|
* import { Effect } from "effect";
|
|
96
|
-
* import { ConfigInspector
|
|
95
|
+
* import { ConfigInspector } from "@savvy-web/changesets";
|
|
97
96
|
*
|
|
98
97
|
* const program = Effect.gen(function* () {
|
|
99
98
|
* const inspector = yield* ConfigInspector;
|
|
@@ -101,12 +100,24 @@ const ClassificationSchema = Schema.Struct({
|
|
|
101
100
|
* return config.packages.map((p) => p.name);
|
|
102
101
|
* });
|
|
103
102
|
*
|
|
104
|
-
* Effect.runPromise(program.pipe(Effect.provide(
|
|
103
|
+
* Effect.runPromise(program.pipe(Effect.provide(ConfigInspector.layer)));
|
|
105
104
|
* ```
|
|
106
105
|
*
|
|
107
106
|
* @public
|
|
108
107
|
*/
|
|
109
|
-
var ConfigInspector = class extends Context.Service()("ConfigInspector") {
|
|
108
|
+
var ConfigInspector = class extends Context.Service()("ConfigInspector") {
|
|
109
|
+
/**
|
|
110
|
+
* Production layer for {@link ConfigInspector}.
|
|
111
|
+
*
|
|
112
|
+
* Requires {@link ChangesetConfigReader} and `WorkspaceDiscovery`
|
|
113
|
+
* in the environment.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
118
|
+
return makeShape(yield* ChangesetConfigReader, yield* WorkspaceDiscovery, yield* FileSystem.FileSystem);
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
110
121
|
/**
|
|
111
122
|
* Pull the changelog formatter ID and its options object out of the raw
|
|
112
123
|
* `.changeset/config.json` shape (where `changelog` may be a tuple, a string,
|
|
@@ -500,22 +511,11 @@ function classifyOne(inspected, path) {
|
|
|
500
511
|
};
|
|
501
512
|
}
|
|
502
513
|
/**
|
|
503
|
-
* Live layer for {@link ConfigInspector}.
|
|
504
|
-
*
|
|
505
|
-
* Requires {@link ChangesetConfigReader} and `WorkspaceDiscovery`
|
|
506
|
-
* in the environment.
|
|
507
|
-
*
|
|
508
|
-
* @public
|
|
509
|
-
*/
|
|
510
|
-
const ConfigInspectorLive = Layer.effect(ConfigInspector, Effect.gen(function* () {
|
|
511
|
-
return makeShape(yield* ChangesetConfigReader, yield* WorkspaceDiscovery, yield* FileSystem.FileSystem);
|
|
512
|
-
}));
|
|
513
|
-
/**
|
|
514
514
|
* Test factory — build a {@link ConfigInspector} that returns a fixed
|
|
515
515
|
* {@link InspectedConfig} without touching the filesystem.
|
|
516
516
|
*
|
|
517
517
|
* Tests that need to exercise the inspect/classify logic against real files
|
|
518
|
-
* should compose `
|
|
518
|
+
* should compose `ConfigInspector.layer` with test layers for
|
|
519
519
|
* `ChangesetConfigReader` and `WorkspaceDiscovery` instead.
|
|
520
520
|
*
|
|
521
521
|
* @public
|
|
@@ -529,4 +529,4 @@ function makeConfigInspectorTest(fixed) {
|
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
//#endregion
|
|
532
|
-
export { ClassificationReasonSchema, ClassificationSchema, ConfigInspector,
|
|
532
|
+
export { ClassificationReasonSchema, ClassificationSchema, ConfigInspector, InspectedConfigSchema, ResolvedPackageScopeSchema, ResolvedVersionFileSchema, makeConfigInspectorTest };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ChangesetIOError } from "../errors.js";
|
|
2
2
|
import { serializeDependencyTableToMarkdown, sortDependencyRows } from "../utils/dependency-table.js";
|
|
3
|
-
import {
|
|
4
|
-
import { ChangesetConfig
|
|
5
|
-
import {
|
|
6
|
-
import { ConfigInspector
|
|
3
|
+
import { ChangesetConfigReader } from "../../services/ChangesetConfigReader.js";
|
|
4
|
+
import { ChangesetConfig } from "../../services/ChangesetConfig.js";
|
|
5
|
+
import { SilkPublishability } from "../../services/SilkPublishability.js";
|
|
6
|
+
import { ConfigInspector } from "./config-inspector.js";
|
|
7
7
|
import { computeWorkspaceDependencyDiffs } from "../utils/dep-diff.js";
|
|
8
8
|
import { gitListChangesetFilesAtRef, gitMergeBase } from "../utils/git.js";
|
|
9
9
|
import { listPublishablePackageNames } from "../utils/publishability.js";
|
|
@@ -43,7 +43,6 @@ import { PublishabilityDetector, WorkspaceDiscovery, WorkspaceSnapshots, Workspa
|
|
|
43
43
|
* and MCP tools are thin adapters over this service.
|
|
44
44
|
*
|
|
45
45
|
* @see {@link DepsRegen} for the service tag
|
|
46
|
-
* @see {@link DepsRegenLive} for the production layer
|
|
47
46
|
*
|
|
48
47
|
*/
|
|
49
48
|
const ADJECTIVES = [
|
|
@@ -242,7 +241,30 @@ function renderChangesetContent(diff) {
|
|
|
242
241
|
*
|
|
243
242
|
* @public
|
|
244
243
|
*/
|
|
245
|
-
var DepsRegen = class extends Context.Service()("Changesets/DepsRegen") {
|
|
244
|
+
var DepsRegen = class extends Context.Service()("Changesets/DepsRegen") {
|
|
245
|
+
/**
|
|
246
|
+
* Production layer for {@link DepsRegen}.
|
|
247
|
+
*
|
|
248
|
+
* Requires `WorkspaceSnapshots`, `WorkspaceDiscovery`,
|
|
249
|
+
* `PublishabilityDetector` (all from `@effected/workspaces`),
|
|
250
|
+
* `Git` (from `@effected/git`, backing merge-base resolution),
|
|
251
|
+
* {@link ConfigInspector}, {@link ChangesetConfig}, and
|
|
252
|
+
* `FileSystem.FileSystem` (resolved once at construction and closed over by
|
|
253
|
+
* the shape, keeping `plan`/`execute` themselves requirement-free).
|
|
254
|
+
*
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
257
|
+
static layer = Layer.effect(this, Effect.gen(function* () {
|
|
258
|
+
const snapshots = yield* WorkspaceSnapshots;
|
|
259
|
+
const inspector = yield* ConfigInspector;
|
|
260
|
+
const discovery = yield* WorkspaceDiscovery;
|
|
261
|
+
const detector = yield* PublishabilityDetector;
|
|
262
|
+
const config = yield* ChangesetConfig;
|
|
263
|
+
const fs = yield* FileSystem.FileSystem;
|
|
264
|
+
const git = yield* Git;
|
|
265
|
+
return makeShape(snapshots, inspector, discovery, detector, config, fs, Layer.succeed(Git, git));
|
|
266
|
+
}));
|
|
267
|
+
};
|
|
246
268
|
/**
|
|
247
269
|
* Build a {@link DepsRegenShape} that closes over already-resolved service
|
|
248
270
|
* implementations, keeping the public `plan`/`execute` signatures
|
|
@@ -262,7 +284,9 @@ function makeShape(snapshots, inspector, discovery, detector, config, fs, provid
|
|
|
262
284
|
if (!baseBranch) baseBranch = (yield* inspector.inspect(resolvedCwd).pipe(Effect.catchTag("ConfigurationError", () => Effect.succeed({ baseBranch: "main" })))).baseBranch;
|
|
263
285
|
fromRef = yield* gitMergeBase(resolvedCwd, baseBranch).pipe(Effect.provide(provideGit));
|
|
264
286
|
}
|
|
265
|
-
const
|
|
287
|
+
const before = yield* snapshots.at(fromRef);
|
|
288
|
+
const after = options.to ? yield* snapshots.at(options.to) : yield* snapshots.worktree();
|
|
289
|
+
const rawDiffs = computeWorkspaceDependencyDiffs(before, after);
|
|
266
290
|
const explicitTargets = /* @__PURE__ */ new Set([...options.packages ?? [], ...options.package ? [options.package] : []]);
|
|
267
291
|
const excluded = new Set(options.exclude ?? []);
|
|
268
292
|
const livePackages = yield* discovery.listPackages();
|
|
@@ -335,29 +359,7 @@ function makeShape(snapshots, inspector, discovery, detector, config, fs, provid
|
|
|
335
359
|
execute
|
|
336
360
|
};
|
|
337
361
|
}
|
|
338
|
-
|
|
339
|
-
* Live layer for {@link DepsRegen}.
|
|
340
|
-
*
|
|
341
|
-
* Requires `WorkspaceSnapshots`, `WorkspaceDiscovery`,
|
|
342
|
-
* `PublishabilityDetector` (all from `@effected/workspaces`),
|
|
343
|
-
* `Git` (from `@effected/git`, backing merge-base resolution),
|
|
344
|
-
* {@link ConfigInspector}, {@link ChangesetConfig}, and
|
|
345
|
-
* `FileSystem.FileSystem` (resolved once at construction and closed over by
|
|
346
|
-
* the shape, keeping `plan`/`execute` themselves requirement-free).
|
|
347
|
-
*
|
|
348
|
-
* @public
|
|
349
|
-
*/
|
|
350
|
-
const DepsRegenLive = Layer.effect(DepsRegen, Effect.gen(function* () {
|
|
351
|
-
const snapshots = yield* WorkspaceSnapshots;
|
|
352
|
-
const inspector = yield* ConfigInspector;
|
|
353
|
-
const discovery = yield* WorkspaceDiscovery;
|
|
354
|
-
const detector = yield* PublishabilityDetector;
|
|
355
|
-
const config = yield* ChangesetConfig;
|
|
356
|
-
const fs = yield* FileSystem.FileSystem;
|
|
357
|
-
const git = yield* Git;
|
|
358
|
-
return makeShape(snapshots, inspector, discovery, detector, config, fs, Layer.succeed(Git, git));
|
|
359
|
-
}));
|
|
360
|
-
const ConfigGraph = ChangesetConfigLive.pipe(Layer.provide(ChangesetConfigReaderLive));
|
|
362
|
+
const ConfigGraph = ChangesetConfig.layer.pipe(Layer.provide(ChangesetConfigReader.layer));
|
|
361
363
|
/**
|
|
362
364
|
* Build the batteries-included {@link DepsRegen} layer over a
|
|
363
365
|
* `@effected/workspaces` kit graph bound to `options.cwd`.
|
|
@@ -379,7 +381,7 @@ const ConfigGraph = ChangesetConfigLive.pipe(Layer.provide(ChangesetConfigReader
|
|
|
379
381
|
*/
|
|
380
382
|
function makeDepsRegenDefault(options) {
|
|
381
383
|
const kitGraph = Workspaces.layerWithGit(options);
|
|
382
|
-
return
|
|
384
|
+
return DepsRegen.layer.pipe(Layer.provide(ConfigInspector.layer.pipe(Layer.provide(Layer.mergeAll(ChangesetConfigReader.layer, kitGraph)))), Layer.provide(SilkPublishability.layerAdaptive.pipe(Layer.provide(Layer.mergeAll(ConfigGraph, kitGraph)))), Layer.provide(ConfigGraph), Layer.provide(kitGraph));
|
|
383
385
|
}
|
|
384
386
|
/**
|
|
385
387
|
* Batteries-included {@link DepsRegen} layer: silk's opinionated default
|
|
@@ -391,10 +393,10 @@ function makeDepsRegenDefault(options) {
|
|
|
391
393
|
* (`NodeServices.layer`), not a bare filesystem-only layer.
|
|
392
394
|
*
|
|
393
395
|
* Gating uses silk's adaptive publishability detector
|
|
394
|
-
* (
|
|
396
|
+
* (`SilkPublishability.layerAdaptive`), so the default semantics
|
|
395
397
|
* are "versionable minus ignored" — identical to the savvy CLI and MCP
|
|
396
398
|
* runtimes. Consumers who need to swap any dependency (test detectors,
|
|
397
|
-
* alternate config sources) should keep composing {@link
|
|
399
|
+
* alternate config sources) should keep composing {@link DepsRegen.layer}
|
|
398
400
|
* directly; this layer is purely additive.
|
|
399
401
|
*
|
|
400
402
|
* @example
|
|
@@ -411,4 +413,4 @@ function makeDepsRegenDefault(options) {
|
|
|
411
413
|
const DepsRegenDefault = makeDepsRegenDefault();
|
|
412
414
|
|
|
413
415
|
//#endregion
|
|
414
|
-
export { DepsRegen, DepsRegenDefault,
|
|
416
|
+
export { DepsRegen, DepsRegenDefault, isPureDependencyChangeset, makeDepsRegenDefault };
|