@savvy-web/silk-effects 5.1.0 → 5.1.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.
Files changed (2) hide show
  1. package/README.md +69 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -107,6 +107,17 @@ const tags = strategy.tagsFor([{ name: "@savvy-web/silk-effects", version: "1.0.
107
107
 
108
108
  `WorkspaceAnalysis.versioning` and `WorkspaceAnalysis.tagStrategy` carry those kit types directly.
109
109
 
110
+ #### ChangesetLinter
111
+
112
+ Validate a changeset file against the Silk section rules. `ChangesetLinter.validateContent(content, filePath?)` and `ChangesetLinter.validateFile(filePath)` are static and synchronous, returning `LintMessage[]` — no Effect, no layers. Rules cover the valid section headings, structural constraints, and the dependency-table format, so a `## Dependencies` section written as prose or a bullet list is reported rather than accepted.
113
+
114
+ ```typescript
115
+ import { Changesets } from "@savvy-web/silk-effects";
116
+
117
+ const messages = Changesets.ChangesetLinter.validateFile(".changeset/quiet-moons-render.md");
118
+ // => [] when the file is valid, otherwise one LintMessage per violation
119
+ ```
120
+
110
121
  ---
111
122
 
112
123
  ### FileSystem layer required
@@ -258,10 +269,68 @@ const result = await Effect.runPromise(
258
269
  // => { updated: true, skipped: false, current: "2.0.0" }
259
270
  ```
260
271
 
272
+ #### ConfigInspector
273
+
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
+
276
+ `Changesets.ConfigInspectorLive` requires `ChangesetConfigReader`, `WorkspaceDiscovery` from [`@effected/workspaces`](https://www.npmjs.com/package/@effected/workspaces) and `FileSystem`.
277
+
278
+ #### ReleasePlanner
279
+
280
+ Drive the genuine changesets engine rather than shelling out to the `changeset` binary. Three members:
281
+
282
+ - `plan(root)` computes the in-memory release plan. It renders nothing, so it resolves no changelog module.
283
+ - `preview(root, options?)` renders a non-destructive preview, running the real engine against a scope-managed temp directory and reading the generated CHANGELOG blocks back. The repository is never mutated.
284
+ - `apply(root, options?)` performs the release — version bumps, CHANGELOG writes and configured version-file updates. Pass `dryRun` to compute without writing.
285
+
286
+ Both `preview` and `apply` accept `changelogModules`, mapping the changelog id configured in `.changeset/config.json` to an absolute module path. Reach for it when running somewhere the configured id cannot be resolved — a bundled GitHub Action with no `node_modules`, for instance. When set, the configured id must be a key of the map, an unmapped id fails with a `ReleasePlanError` naming the supported keys, and the engine's formatter integration is disabled so the caller owns formatting.
287
+
288
+ ```typescript
289
+ const preview = yield* planner.preview(root, {
290
+ changelogModules: { "@savvy-web/changelog": changelogModulePath },
291
+ });
292
+ // => ChangesetPreview: per-release changelogEntry, versions and changeset ids
293
+ ```
294
+
295
+ `Changesets.ReleasePlannerLive` requires `ConfigInspector` and `FileSystem`.
296
+
261
297
  ---
262
298
 
263
299
  ### FileSystem + process layer required
264
300
 
301
+ #### BranchAnalyzer
302
+
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
+
305
+ `Changesets.BranchAnalyzerLive` requires `ConfigInspector` and the platform process spawner.
306
+
307
+ #### DepsRegen
308
+
309
+ Own dependency-changeset orchestration, split so that detection and regeneration share one code path: `plan(options)` computes a complete, side-effect-free `RegenPlan` — target filenames, each row's from/to version, and any stale pure-dependency changesets marked for deletion — and `execute(plan)` applies exactly what the plan describes. A dry run is `plan()` plus rendering.
310
+
311
+ Both sides of the diff are snapshotted at their own git ref, so `catalog:` and `workspace:` specifiers resolve per side before the comparison. A specifier that changes protocol without changing its resolved version produces no row.
312
+
313
+ `Changesets.DepsRegenDefault` is the batteries-included layer, composing the full graph with silk's opinionated defaults and leaving only the platform services open. Because snapshots read git history, provide a spawn-capable layer such as `NodeServices.layer` rather than a filesystem-only one.
314
+
315
+ ```typescript
316
+ import { Effect } from "effect";
317
+ import { NodeServices } from "@effect/platform-node";
318
+ import { Changesets } from "@savvy-web/silk-effects";
319
+
320
+ const plan = await Effect.runPromise(
321
+ Effect.gen(function* () {
322
+ const regen = yield* Changesets.DepsRegen;
323
+ return yield* regen.plan({});
324
+ }).pipe(
325
+ Effect.provide(Changesets.DepsRegenDefault),
326
+ Effect.provide(NodeServices.layer),
327
+ ),
328
+ );
329
+ // => RegenPlan: files to write, rows per package, changesets to delete
330
+ ```
331
+
332
+ `Changesets.DepsRegenLive` is the seam for callers injecting their own dependencies; it requires `WorkspaceSnapshots`, `ConfigInspector`, `WorkspaceDiscovery`, `PublishabilityDetector`, `ChangesetConfig`, `Git` and `FileSystem`.
333
+
265
334
  #### TurboInspector
266
335
 
267
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvy-web/silk-effects",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "private": false,
5
5
  "description": "Shared Effect library for Silk Suite conventions",
6
6
  "homepage": "https://github.com/savvy-web/systems/tree/main/packages/silk-effects",