@savvy-web/silk-effects 3.3.1 → 4.0.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 (72) hide show
  1. package/changesets/changelog/getReleaseLine.js +1 -1
  2. package/changesets/constants.js +0 -18
  3. package/changesets/index.js +10 -24
  4. package/changesets/schemas/changeset.js +8 -4
  5. package/changesets/schemas/dependency-table.js +15 -4
  6. package/changesets/schemas/git.js +7 -2
  7. package/changesets/schemas/github.js +4 -4
  8. package/changesets/schemas/options.js +3 -3
  9. package/changesets/schemas/package-scope.js +2 -5
  10. package/changesets/schemas/primitives.js +2 -2
  11. package/changesets/schemas/release-plan.js +12 -8
  12. package/changesets/schemas/version-files.js +4 -4
  13. package/changesets/services/branch-analyzer.js +60 -191
  14. package/changesets/services/changelog.js +2 -15
  15. package/changesets/services/config-inspector.js +109 -75
  16. package/changesets/services/deps-regen.js +58 -32
  17. package/changesets/services/github.js +3 -16
  18. package/changesets/services/maintenance-reason.js +5 -1
  19. package/changesets/services/markdown.js +3 -16
  20. package/changesets/services/release-planner.js +4 -13
  21. package/changesets/utils/commit-parser.js +0 -18
  22. package/changesets/utils/dep-diff.js +0 -27
  23. package/changesets/utils/git.js +15 -50
  24. package/changesets/utils/issue-refs.js +0 -13
  25. package/changesets/utils/logger.js +0 -13
  26. package/changesets/utils/markdown-link.js +0 -14
  27. package/changesets/utils/publishability.js +11 -24
  28. package/changesets/utils/strip-frontmatter.js +0 -19
  29. package/changesets/utils/version-files.js +85 -51
  30. package/commitlint/config/schema.js +9 -5
  31. package/commitlint/detection/scopes.js +2 -7
  32. package/commitlint/formatter/messages.js +0 -5
  33. package/commitlint/hook/diagnostics/branch.js +12 -12
  34. package/commitlint/hook/diagnostics/open-issues.js +13 -7
  35. package/commitlint/hook/diagnostics/signing.js +30 -37
  36. package/commitlint/hook/envelope.js +2 -8
  37. package/commitlint/hook/silence-logger.js +14 -12
  38. package/index.d.ts +897 -932
  39. package/lint/cli/templates/markdownlint.gen.js +0 -9
  40. package/lint/handlers/PnpmWorkspace.js +26 -12
  41. package/lint/utils/Filter.js +0 -13
  42. package/lint/utils/Workspace.js +10 -6
  43. package/package.json +11 -10
  44. package/repos/index.js +3 -5
  45. package/repos/schemas/manifest.js +7 -13
  46. package/repos/schemas/reports.js +5 -1
  47. package/repos/services/config-store.js +6 -10
  48. package/repos/services/manager.js +52 -112
  49. package/schemas/CommentStyle.js +1 -1
  50. package/schemas/ResolvedTool.js +52 -17
  51. package/schemas/SectionBlock.js +1 -1
  52. package/schemas/SectionDefinition.js +2 -2
  53. package/schemas/TagStrategySchemas.js +1 -1
  54. package/schemas/ToolDefinition.js +1 -1
  55. package/schemas/ToolResults.js +1 -1
  56. package/schemas/VersioningSchemas.js +28 -9
  57. package/schemas/WorkspaceAnalysisSchemas.js +27 -17
  58. package/services/BiomeSchemaSync.js +7 -8
  59. package/services/ChangesetConfig.js +2 -2
  60. package/services/ChangesetConfigReader.js +7 -8
  61. package/services/ConfigDiscovery.js +5 -6
  62. package/services/ManagedSection.js +3 -4
  63. package/services/SilkPublishability.js +38 -15
  64. package/services/SilkWorkspaceAnalyzer.js +7 -9
  65. package/services/TagStrategy.js +3 -3
  66. package/services/ToolDiscovery.js +22 -21
  67. package/services/VersioningStrategy.js +2 -2
  68. package/tsdoc-metadata.json +1 -1
  69. package/turbo/schemas/DryRun.js +8 -14
  70. package/turbo/schemas/results.js +8 -8
  71. package/turbo/services/TurboInspector.js +30 -23
  72. package/utils/ToolCommand.js +38 -12
@@ -1,10 +1,15 @@
1
1
  import { ToolCommand } from "../utils/ToolCommand.js";
2
2
  import { ToolSource } from "./ToolResults.js";
3
3
  import { Equal, Hash, Schema } from "effect";
4
- import { Command } from "@effect/platform";
4
+ import { ChildProcess } from "effect/unstable/process";
5
5
 
6
6
  //#region src/schemas/ResolvedTool.ts
7
- const PackageManager = Schema.Literal("npm", "pnpm", "yarn", "bun");
7
+ const PackageManager = Schema.Literals([
8
+ "npm",
9
+ "pnpm",
10
+ "yarn",
11
+ "bun"
12
+ ]);
8
13
  /**
9
14
  * Result of resolving a {@link ToolDefinition}.
10
15
  *
@@ -16,9 +21,9 @@ const PackageManager = Schema.Literal("npm", "pnpm", "yarn", "bun");
16
21
  var ResolvedTool = class ResolvedTool extends Schema.TaggedClass()("ResolvedTool", {
17
22
  name: Schema.String,
18
23
  source: ToolSource,
19
- version: Schema.OptionFromSelf(Schema.String),
20
- globalVersion: Schema.OptionFromSelf(Schema.String),
21
- localVersion: Schema.OptionFromSelf(Schema.String),
24
+ version: Schema.Option(Schema.String),
25
+ globalVersion: Schema.Option(Schema.String),
26
+ localVersion: Schema.Option(Schema.String),
22
27
  packageManager: PackageManager,
23
28
  mismatch: Schema.Boolean
24
29
  }) {
@@ -32,20 +37,50 @@ var ResolvedTool = class ResolvedTool extends Schema.TaggedClass()("ResolvedTool
32
37
  return this.mismatch;
33
38
  }
34
39
  exec(...args) {
35
- if (this.source === "global") return new ToolCommand(Command.make(this.name, ...args));
40
+ if (this.source === "global") return new ToolCommand(ChildProcess.make(this.name, args));
36
41
  switch (this.packageManager) {
37
- case "pnpm": return new ToolCommand(Command.make("pnpm", "exec", this.name, ...args));
38
- case "npm": return new ToolCommand(Command.make("npx", "--no", "--", this.name, ...args));
39
- case "yarn": return new ToolCommand(Command.make("yarn", "exec", this.name, ...args));
40
- case "bun": return new ToolCommand(Command.make("bun", "x", "--no-install", this.name, ...args));
42
+ case "pnpm": return new ToolCommand(ChildProcess.make("pnpm", [
43
+ "exec",
44
+ this.name,
45
+ ...args
46
+ ]));
47
+ case "npm": return new ToolCommand(ChildProcess.make("npx", [
48
+ "--no",
49
+ "--",
50
+ this.name,
51
+ ...args
52
+ ]));
53
+ case "yarn": return new ToolCommand(ChildProcess.make("yarn", [
54
+ "exec",
55
+ this.name,
56
+ ...args
57
+ ]));
58
+ case "bun": return new ToolCommand(ChildProcess.make("bun", [
59
+ "x",
60
+ "--no-install",
61
+ this.name,
62
+ ...args
63
+ ]));
41
64
  }
42
65
  }
43
66
  dlx(...args) {
44
67
  switch (this.packageManager) {
45
- case "pnpm": return new ToolCommand(Command.make("pnpm", "dlx", this.name, ...args));
46
- case "npm": return new ToolCommand(Command.make("npx", this.name, ...args));
47
- case "yarn": return new ToolCommand(Command.make("yarn", "dlx", this.name, ...args));
48
- case "bun": return new ToolCommand(Command.make("bun", "x", this.name, ...args));
68
+ case "pnpm": return new ToolCommand(ChildProcess.make("pnpm", [
69
+ "dlx",
70
+ this.name,
71
+ ...args
72
+ ]));
73
+ case "npm": return new ToolCommand(ChildProcess.make("npx", [this.name, ...args]));
74
+ case "yarn": return new ToolCommand(ChildProcess.make("yarn", [
75
+ "dlx",
76
+ this.name,
77
+ ...args
78
+ ]));
79
+ case "bun": return new ToolCommand(ChildProcess.make("bun", [
80
+ "x",
81
+ this.name,
82
+ ...args
83
+ ]));
49
84
  }
50
85
  }
51
86
  [Equal.symbol](that) {
@@ -54,9 +89,9 @@ var ResolvedTool = class ResolvedTool extends Schema.TaggedClass()("ResolvedTool
54
89
  }
55
90
  [Hash.symbol]() {
56
91
  let h = Hash.hash(this.name);
57
- h = Hash.combine(h)(Hash.hash(this.source));
58
- h = Hash.combine(h)(Hash.hash(this.version));
59
- return Hash.cached(this)(h);
92
+ h = Hash.combine(h, Hash.hash(this.source));
93
+ h = Hash.combine(h, Hash.hash(this.version));
94
+ return Hash.optimize(h);
60
95
  }
61
96
  };
62
97
 
@@ -63,7 +63,7 @@ var SectionBlock = class SectionBlock extends Schema.TaggedClass()("SectionBlock
63
63
  return this.normalized === that.normalized;
64
64
  }
65
65
  [Hash.symbol]() {
66
- return Hash.cached(this)(Hash.hash(this.normalized));
66
+ return Hash.optimize(Hash.hash(this.normalized));
67
67
  }
68
68
  };
69
69
 
@@ -17,7 +17,7 @@ import { Effect, Equal, Function, Hash, Schema } from "effect";
17
17
  */
18
18
  var SectionDefinition = class SectionDefinition extends Schema.TaggedClass()("SectionDefinition", {
19
19
  toolName: Schema.String,
20
- commentStyle: Schema.optionalWith(CommentStyle, { default: () => "#" })
20
+ commentStyle: CommentStyle.pipe(Schema.withDecodingDefaultType(Effect.succeed("#")), Schema.withConstructorDefault(Effect.succeed("#")))
21
21
  }) {
22
22
  _validate;
23
23
  static generate = Function.dual(2, (self, fn) => {
@@ -83,7 +83,7 @@ var SectionDefinition = class SectionDefinition extends Schema.TaggedClass()("Se
83
83
  return this.toolName === that.toolName && this.commentStyle === that.commentStyle;
84
84
  }
85
85
  [Hash.symbol]() {
86
- return Hash.cached(this)(Hash.combine(Hash.hash(this.toolName))(Hash.hash(this.commentStyle)));
86
+ return Hash.optimize(Hash.combine(Hash.hash(this.toolName), Hash.hash(this.commentStyle)));
87
87
  }
88
88
  };
89
89
  /**
@@ -13,7 +13,7 @@ import { Schema } from "effect";
13
13
  * @since 0.1.0
14
14
  * @public
15
15
  */
16
- const TagStrategyType = Schema.Literal("single", "scoped");
16
+ const TagStrategyType = Schema.Literals(["single", "scoped"]);
17
17
 
18
18
  //#endregion
19
19
  export { TagStrategyType };
@@ -32,7 +32,7 @@ var ToolDefinition = class ToolDefinition {
32
32
  return this.name === that.name;
33
33
  }
34
34
  [Hash.symbol]() {
35
- return Hash.cached(this)(Hash.hash(this.name));
35
+ return Hash.optimize(Hash.hash(this.name));
36
36
  }
37
37
  };
38
38
 
@@ -7,7 +7,7 @@ import { Data, Schema } from "effect";
7
7
  * @since 0.2.0
8
8
  * @public
9
9
  */
10
- const ToolSource = Schema.Literal("global", "local");
10
+ const ToolSource = Schema.Literals(["global", "local"]);
11
11
  /**
12
12
  * @since 0.2.0
13
13
  * @public
@@ -1,4 +1,4 @@
1
- import { Schema } from "effect";
1
+ import { Effect, Schema } from "effect";
2
2
 
3
3
  //#region src/schemas/VersioningSchemas.ts
4
4
  /**
@@ -11,10 +11,10 @@ import { Schema } from "effect";
11
11
  *
12
12
  * @since 0.2.0
13
13
  */
14
- const PrivatePackagesConfig = Schema.Union(Schema.Struct({
14
+ const PrivatePackagesConfig = Schema.Union([Schema.Struct({
15
15
  tag: Schema.optional(Schema.Boolean),
16
16
  version: Schema.optional(Schema.Boolean)
17
- }), Schema.Literal(false));
17
+ }), Schema.Literal(false)]);
18
18
  /**
19
19
  * Snapshot release configuration for changesets.
20
20
  *
@@ -41,13 +41,25 @@ const SnapshotConfig = Schema.Struct({
41
41
  */
42
42
  /** @public */
43
43
  const ChangesetConfigFile = Schema.Struct({
44
- changelog: Schema.optional(Schema.Union(Schema.String, Schema.Array(Schema.Unknown), Schema.Literal(false))),
45
- commit: Schema.optional(Schema.Union(Schema.Boolean, Schema.String, Schema.Array(Schema.Unknown))),
44
+ changelog: Schema.optional(Schema.Union([
45
+ Schema.String,
46
+ Schema.Array(Schema.Unknown),
47
+ Schema.Literal(false)
48
+ ])),
49
+ commit: Schema.optional(Schema.Union([
50
+ Schema.Boolean,
51
+ Schema.String,
52
+ Schema.Array(Schema.Unknown)
53
+ ])),
46
54
  fixed: Schema.optional(Schema.Array(Schema.Array(Schema.String))),
47
55
  linked: Schema.optional(Schema.Array(Schema.Array(Schema.String))),
48
- access: Schema.optional(Schema.Literal("public", "restricted")),
56
+ access: Schema.optional(Schema.Literals(["public", "restricted"])),
49
57
  baseBranch: Schema.optional(Schema.String),
50
- updateInternalDependencies: Schema.optional(Schema.Literal("patch", "minor", "major")),
58
+ updateInternalDependencies: Schema.optional(Schema.Literals([
59
+ "patch",
60
+ "minor",
61
+ "major"
62
+ ])),
51
63
  ignore: Schema.optional(Schema.Array(Schema.String)),
52
64
  privatePackages: Schema.optional(PrivatePackagesConfig),
53
65
  prettier: Schema.optional(Schema.Boolean),
@@ -66,7 +78,10 @@ const ChangesetConfigFile = Schema.Struct({
66
78
  * @since 0.1.0
67
79
  */
68
80
  /** @public */
69
- const SilkChangesetConfigFile = Schema.extend(ChangesetConfigFile, Schema.Struct({ _isSilk: Schema.optionalWith(Schema.Boolean, { default: () => true }) }));
81
+ const SilkChangesetConfigFile = Schema.Struct({
82
+ ...ChangesetConfigFile.fields,
83
+ _isSilk: Schema.Boolean.pipe(Schema.withDecodingDefaultType(Effect.succeed(true)), Schema.withConstructorDefault(Effect.succeed(true)))
84
+ });
70
85
  /**
71
86
  * Versioning strategy classification for a workspace.
72
87
  *
@@ -78,7 +93,11 @@ const SilkChangesetConfigFile = Schema.extend(ChangesetConfigFile, Schema.Struct
78
93
  * @since 0.1.0
79
94
  * @public
80
95
  */
81
- const VersioningStrategyType = Schema.Literal("single", "fixed-group", "independent");
96
+ const VersioningStrategyType = Schema.Literals([
97
+ "single",
98
+ "fixed-group",
99
+ "independent"
100
+ ]);
82
101
  /**
83
102
  * Output of the versioning strategy detection, combining the strategy type with group metadata.
84
103
  *
@@ -1,17 +1,21 @@
1
1
  import { ChangesetConfigFile, SilkChangesetConfigFile, VersioningStrategyResult } from "./VersioningSchemas.js";
2
2
  import { trimTrailingSlashes } from "../utils/TrailingSlash.js";
3
3
  import { TagStrategyType } from "./TagStrategySchemas.js";
4
- import { Equal, Function, Hash, Option, Pretty, Schema } from "effect";
5
- import { PublishConfig, PublishTarget } from "workspaces-effect";
4
+ import { Effect, Equal, Function, Hash, Option, Schema } from "effect";
5
+ import { PublishConfig, PublishTarget } from "@effected/workspaces";
6
6
 
7
7
  //#region src/schemas/WorkspaceAnalysisSchemas.ts
8
- const PublishProtocol = Schema.Literal("npm", "jsr");
9
- const PublishTargetShorthand = Schema.Literal("npm", "github", "jsr");
8
+ const PublishProtocol = Schema.Literals(["npm", "jsr"]);
9
+ const PublishTargetShorthand = Schema.Literals([
10
+ "npm",
11
+ "github",
12
+ "jsr"
13
+ ]);
10
14
  const PublishTargetObject = Schema.Struct({
11
- protocol: Schema.optionalWith(PublishProtocol, { default: () => "npm" }),
15
+ protocol: PublishProtocol.pipe(Schema.withDecodingDefaultType(Effect.succeed("npm")), Schema.withConstructorDefault(Effect.succeed("npm"))),
12
16
  registry: Schema.optional(Schema.String),
13
17
  directory: Schema.optional(Schema.String),
14
- access: Schema.optional(Schema.Literal("public", "restricted")),
18
+ access: Schema.optional(Schema.Literals(["public", "restricted"])),
15
19
  provenance: Schema.optional(Schema.Boolean),
16
20
  tag: Schema.optional(Schema.String)
17
21
  });
@@ -19,14 +23,15 @@ const PublishTargetObject = Schema.Struct({
19
23
  * Silk-extended publishConfig schema.
20
24
  *
21
25
  * @remarks
22
- * Extends the base PublishConfig from workspaces-effect (which covers npm
23
- * standard fields: access, registry, directory, tag, linkDirectory) with the
24
- * Silk `targets` extension for multi-registry publishing.
26
+ * Extends the base PublishConfig from `@effected/workspaces` (which covers the
27
+ * npm standard fields access, registry, directory, tag — and, as of kit
28
+ * round 3, `linkDirectory`) with the Silk `targets` extension for
29
+ * multi-registry publishing.
25
30
  *
26
31
  * @since 0.2.0
27
32
  * @public
28
33
  */
29
- var SilkPublishConfig = class extends PublishConfig.extend("SilkPublishConfig")({ targets: Schema.optional(Schema.Array(Schema.Union(PublishTargetShorthand, PublishTargetObject))) }) {};
34
+ var SilkPublishConfig = class extends PublishConfig.extend("SilkPublishConfig")({ targets: Schema.optional(Schema.Array(Schema.Union([PublishTargetShorthand, PublishTargetObject]))) }) {};
30
35
  const KNOWN_REGISTRIES = {
31
36
  npm: "https://registry.npmjs.org/",
32
37
  github: "https://npm.pkg.github.com/",
@@ -94,7 +99,7 @@ var AnalyzedWorkspace = class AnalyzedWorkspace extends Schema.TaggedClass()("An
94
99
  return this.name === that.name && this.path === that.path;
95
100
  }
96
101
  [Hash.symbol]() {
97
- return Hash.cached(this)(Hash.combine(Hash.hash(this.name))(Hash.hash(this.path)));
102
+ return Hash.optimize(Hash.combine(Hash.hash(this.name), Hash.hash(this.path)));
98
103
  }
99
104
  toString() {
100
105
  return `${this.name}@${this.version.current}`;
@@ -127,9 +132,14 @@ AnalyzedWorkspace.findByName = Function.dual(2, (workspaces, name) => {
127
132
  const found = workspaces.find((w) => w.name === name);
128
133
  return found ? Option.some(found) : Option.none();
129
134
  });
130
- AnalyzedWorkspace.pretty = Pretty.make(AnalyzedWorkspace);
135
+ AnalyzedWorkspace.pretty = Schema.toFormatter(AnalyzedWorkspace);
131
136
  const PackageManagerInfo = Schema.Struct({
132
- type: Schema.Literal("npm", "pnpm", "yarn", "bun"),
137
+ type: Schema.Literals([
138
+ "npm",
139
+ "pnpm",
140
+ "yarn",
141
+ "bun"
142
+ ]),
133
143
  version: Schema.optional(Schema.String)
134
144
  });
135
145
  /**
@@ -141,10 +151,10 @@ const PackageManagerInfo = Schema.Struct({
141
151
  */
142
152
  var WorkspaceAnalysis = class WorkspaceAnalysis extends Schema.TaggedClass()("WorkspaceAnalysis", {
143
153
  root: Schema.String,
144
- runtime: Schema.Literal("node", "bun"),
154
+ runtime: Schema.Literals(["node", "bun"]),
145
155
  packageManager: PackageManagerInfo,
146
156
  workspaces: Schema.Array(AnalyzedWorkspace),
147
- changesetConfig: Schema.NullOr(Schema.Union(SilkChangesetConfigFile, ChangesetConfigFile)),
157
+ changesetConfig: Schema.NullOr(Schema.Union([SilkChangesetConfigFile, ChangesetConfigFile])),
148
158
  versioning: Schema.NullOr(VersioningStrategyResult),
149
159
  tagStrategy: Schema.NullOr(TagStrategyType)
150
160
  }) {
@@ -180,7 +190,7 @@ var WorkspaceAnalysis = class WorkspaceAnalysis extends Schema.TaggedClass()("Wo
180
190
  return this.root === that.root;
181
191
  }
182
192
  [Hash.symbol]() {
183
- return Hash.cached(this)(Hash.hash(this.root));
193
+ return Hash.optimize(Hash.hash(this.root));
184
194
  }
185
195
  toString() {
186
196
  return `WorkspaceAnalysis(${this.root}, ${this.workspaces.length} workspaces)`;
@@ -188,7 +198,7 @@ var WorkspaceAnalysis = class WorkspaceAnalysis extends Schema.TaggedClass()("Wo
188
198
  /** Pretty-print a WorkspaceAnalysis instance. */
189
199
  static pretty;
190
200
  };
191
- WorkspaceAnalysis.pretty = Pretty.make(WorkspaceAnalysis);
201
+ WorkspaceAnalysis.pretty = Schema.toFormatter(WorkspaceAnalysis);
192
202
 
193
203
  //#endregion
194
204
  export { AnalyzedWorkspace, SilkPublishConfig, WorkspaceAnalysis };
@@ -1,7 +1,6 @@
1
1
  import { BiomeSyncError } from "../errors/BiomeSyncError.js";
2
- import { Context, Effect, Layer } from "effect";
3
- import { FileSystem } from "@effect/platform";
4
- import { parse } from "jsonc-effect";
2
+ import { Context, Effect, FileSystem, Layer } from "effect";
3
+ import { Jsonc } from "@effected/jsonc";
5
4
 
6
5
  //#region src/services/BiomeSchemaSync.ts
7
6
  /**
@@ -54,7 +53,7 @@ function findBiomeConfigs(cwd, fs) {
54
53
  * return yield* syncer.sync("^1.9.3");
55
54
  * }).pipe(
56
55
  * Effect.provide(BiomeSchemaSyncLive),
57
- * Effect.provide(NodeContext.layer),
56
+ * Effect.provide(NodeServices.layer),
58
57
  * )
59
58
  * );
60
59
  * ```
@@ -62,13 +61,13 @@ function findBiomeConfigs(cwd, fs) {
62
61
  * @since 0.1.0
63
62
  * @public
64
63
  */
65
- var BiomeSchemaSync = class extends Context.Tag("@savvy-web/silk-effects/BiomeSchemaSync")() {};
64
+ var BiomeSchemaSync = class extends Context.Service()("@savvy-web/silk-effects/BiomeSchemaSync") {};
66
65
  /**
67
66
  * Live implementation of {@link BiomeSchemaSync}.
68
67
  *
69
68
  * @remarks
70
- * Requires `FileSystem` from `@effect/platform`. Provide `NodeContext.layer` or
71
- * `BunContext.layer` to satisfy this dependency.
69
+ * Requires the core `FileSystem` service. Provide `NodeServices.layer` (or
70
+ * `NodeFileSystem.layer`) from `@effect/platform-node` to satisfy this dependency.
72
71
  *
73
72
  * @since 0.1.0
74
73
  * @public
@@ -90,7 +89,7 @@ const BiomeSchemaSyncLive = Layer.effect(BiomeSchemaSync, Effect.gen(function* (
90
89
  reason: String(cause)
91
90
  })
92
91
  ));
93
- const schema = (yield* parse(raw).pipe(Effect.mapError(
92
+ const schema = (yield* Jsonc.parse(raw).pipe(Effect.mapError(
94
93
  /* v8 ignore next 4 -- error path requires a JSONC parse failure */
95
94
  (e) => new BiomeSyncError({
96
95
  path: configPath,
@@ -13,7 +13,7 @@ import { Context, Effect, Layer, Option } from "effect";
13
13
  * @since 0.4.0
14
14
  * @public
15
15
  */
16
- var ChangesetConfig = class extends Context.Tag("@savvy-web/silk-effects/ChangesetConfig")() {
16
+ var ChangesetConfig = class extends Context.Service()("@savvy-web/silk-effects/ChangesetConfig") {
17
17
  /**
18
18
  * The one ignore matcher: exact name match, or `@scope/*` wildcard.
19
19
  *
@@ -34,7 +34,7 @@ const isSilk = (cfg) => "_isSilk" in cfg && cfg._isSilk === true;
34
34
  *
35
35
  * @remarks
36
36
  * Requires `ChangesetConfigReader` (which requires `FileSystem`). Provide
37
- * `ChangesetConfigReaderLive` + a platform layer (`NodeContext.layer`).
37
+ * `ChangesetConfigReaderLive` + a platform layer (`NodeServices.layer`).
38
38
  *
39
39
  * @since 0.4.0
40
40
  * @public
@@ -1,7 +1,6 @@
1
1
  import { ChangesetConfigError } from "../errors/ChangesetConfigError.js";
2
2
  import { ChangesetConfigFile, SilkChangesetConfigFile } from "../schemas/VersioningSchemas.js";
3
- import { Context, Effect, Layer, Schema } from "effect";
4
- import { FileSystem } from "@effect/platform";
3
+ import { Context, Effect, FileSystem, Layer, Schema } from "effect";
5
4
 
6
5
  //#region src/services/ChangesetConfigReader.ts
7
6
  /**
@@ -43,7 +42,7 @@ function isSilkChangelog(changelog) {
43
42
  * return yield* reader.read(process.cwd());
44
43
  * }).pipe(
45
44
  * Effect.provide(ChangesetConfigReaderLive),
46
- * Effect.provide(NodeContext.layer),
45
+ * Effect.provide(NodeServices.layer),
47
46
  * )
48
47
  * );
49
48
  * ```
@@ -51,13 +50,13 @@ function isSilkChangelog(changelog) {
51
50
  * @since 0.1.0
52
51
  * @public
53
52
  */
54
- var ChangesetConfigReader = class extends Context.Tag("@savvy-web/silk-effects/ChangesetConfigReader")() {};
53
+ var ChangesetConfigReader = class extends Context.Service()("@savvy-web/silk-effects/ChangesetConfigReader") {};
55
54
  /**
56
55
  * Live implementation of {@link ChangesetConfigReader}.
57
56
  *
58
57
  * @remarks
59
- * Requires `FileSystem` from `@effect/platform`. Provide `NodeContext.layer` or
60
- * `BunContext.layer` to satisfy this dependency.
58
+ * Requires the core `FileSystem` service. Provide `NodeServices.layer` (or
59
+ * `NodeFileSystem.layer`) from `@effect/platform-node` to satisfy this dependency.
61
60
  *
62
61
  * @since 0.1.0
63
62
  * @public
@@ -91,14 +90,14 @@ const ChangesetConfigReaderLive = Layer.effect(ChangesetConfigReader, Effect.gen
91
90
  reason: `Invalid JSON: ${String(cause)}`
92
91
  })
93
92
  });
94
- if (isSilkChangelog(parsed.changelog)) return yield* Schema.decodeUnknown(SilkChangesetConfigFile)(parsed).pipe(Effect.mapError(
93
+ if (isSilkChangelog(parsed.changelog)) return yield* Schema.decodeUnknownEffect(SilkChangesetConfigFile)(parsed).pipe(Effect.mapError(
95
94
  /* v8 ignore next 4 -- error path requires schema decode failure */
96
95
  (cause) => new ChangesetConfigError({
97
96
  path: configPath,
98
97
  reason: `Schema decode failed: ${String(cause)}`
99
98
  })
100
99
  ));
101
- return yield* Schema.decodeUnknown(ChangesetConfigFile)(parsed).pipe(Effect.mapError(
100
+ return yield* Schema.decodeUnknownEffect(ChangesetConfigFile)(parsed).pipe(Effect.mapError(
102
101
  /* v8 ignore next 4 -- error path requires schema decode failure */
103
102
  (cause) => new ChangesetConfigError({
104
103
  path: configPath,
@@ -1,5 +1,4 @@
1
- import { Context, Effect, Layer } from "effect";
2
- import { FileSystem } from "@effect/platform";
1
+ import { Context, Effect, FileSystem, Layer } from "effect";
3
2
 
4
3
  //#region src/services/ConfigDiscovery.ts
5
4
  /**
@@ -20,7 +19,7 @@ import { FileSystem } from "@effect/platform";
20
19
  * return yield* discovery.find("biome.json");
21
20
  * }).pipe(
22
21
  * Effect.provide(ConfigDiscoveryLive),
23
- * Effect.provide(NodeContext.layer),
22
+ * Effect.provide(NodeServices.layer),
24
23
  * )
25
24
  * );
26
25
  * ```
@@ -28,7 +27,7 @@ import { FileSystem } from "@effect/platform";
28
27
  * @since 0.1.0
29
28
  * @public
30
29
  */
31
- var ConfigDiscovery = class extends Context.Tag("@savvy-web/silk-effects/ConfigDiscovery")() {};
30
+ var ConfigDiscovery = class extends Context.Service()("@savvy-web/silk-effects/ConfigDiscovery") {};
32
31
  /**
33
32
  * Check whether a path exists, treating any PlatformError as "not found".
34
33
  */
@@ -39,8 +38,8 @@ function safeExists(fs, path) {
39
38
  * Live implementation of {@link ConfigDiscovery}.
40
39
  *
41
40
  * @remarks
42
- * Requires `FileSystem` from `@effect/platform`. Provide `NodeContext.layer` or
43
- * `BunContext.layer` to satisfy this dependency.
41
+ * Requires the core `FileSystem` service. Provide `NodeServices.layer` (or
42
+ * `NodeFileSystem.layer`) from `@effect/platform-node` to satisfy this dependency.
44
43
  *
45
44
  * @since 0.1.0
46
45
  * @public
@@ -2,8 +2,7 @@ import { SectionParseError } from "../errors/SectionParseError.js";
2
2
  import { SectionWriteError } from "../errors/SectionWriteError.js";
3
3
  import { CheckResult, SyncResult } from "../schemas/SectionResults.js";
4
4
  import { SectionBlock } from "../schemas/SectionBlock.js";
5
- import { Context, Effect, Equal, Function, Layer } from "effect";
6
- import { FileSystem } from "@effect/platform";
5
+ import { Context, Effect, Equal, FileSystem, Function, Layer } from "effect";
7
6
 
8
7
  //#region src/services/ManagedSection.ts
9
8
  function beginMarker(toolName, commentStyle) {
@@ -72,9 +71,9 @@ function findAllSections(content) {
72
71
  * @since 0.2.0
73
72
  * @public
74
73
  */
75
- var ManagedSection = class extends Context.Tag("@savvy-web/silk-effects/ManagedSection")() {};
74
+ var ManagedSection = class extends Context.Service()("@savvy-web/silk-effects/ManagedSection") {};
76
75
  /**
77
- * Live implementation of {@link ManagedSection} backed by `@effect/platform` FileSystem.
76
+ * Live implementation of {@link ManagedSection} backed by the core `FileSystem` service.
78
77
  *
79
78
  * @since 0.2.0
80
79
  * @public
@@ -1,10 +1,9 @@
1
1
  import { PublishTargetBindingError } from "../errors/PublishTargetBindingError.js";
2
2
  import { trimTrailingSlashes } from "../utils/TrailingSlash.js";
3
3
  import { ChangesetConfig } from "./ChangesetConfig.js";
4
- import { Effect, Layer } from "effect";
4
+ import { Effect, FileSystem, Layer } from "effect";
5
5
  import { isAbsolute, join, relative } from "node:path";
6
- import { FileSystem } from "@effect/platform";
7
- import { PublishTarget, PublishabilityDetector, PublishabilityDetectorLive, WorkspaceDiscovery } from "workspaces-effect";
6
+ import { PublishTarget, PublishabilityDetector, WorkspaceDiscovery } from "@effected/workspaces";
8
7
 
9
8
  //#region src/services/SilkPublishability.ts
10
9
  const NPM_DEFAULT = "https://registry.npmjs.org/";
@@ -38,7 +37,7 @@ const provenanceForRegistry = (registry) => {
38
37
  return hostname === "registry.npmjs.org" || hostname === "npm.pkg.github.com";
39
38
  };
40
39
  /**
41
- * Silk publishability rules over `workspaces-effect`'s `PublishTarget`.
40
+ * Silk publishability rules over `@effected/workspaces`' `PublishTarget`.
42
41
  *
43
42
  * @remarks
44
43
  * In silk mode `private: true` is the norm on workspace `package.json`; publishability is
@@ -133,11 +132,11 @@ var SilkPublishability = class {
133
132
  * Before the prod build runs there is no binding, and the detector's
134
133
  * placeholder directories are left alone.
135
134
  */
136
- static resolveTargets(pkg, root) {
135
+ static resolveTargets(pkg, _root) {
137
136
  return Effect.gen(function* () {
138
137
  const detector = yield* PublishabilityDetector;
139
138
  const fs = yield* FileSystem.FileSystem;
140
- const targets = yield* detector.detect(pkg, root);
139
+ const targets = yield* detector.detect(pkg);
141
140
  const kept = [];
142
141
  for (const t of targets) {
143
142
  const dir = isAbsolute(t.directory) ? t.directory : join(pkg.path, t.directory);
@@ -162,14 +161,14 @@ var SilkPublishability = class {
162
161
  * The publishable, non-ignored packages, resolved through the single
163
162
  * {@link SilkPublishability} (which already honors changeset ignore in adaptive mode).
164
163
  */
165
- static listPublishable(root) {
164
+ static listPublishable(_root) {
166
165
  return Effect.gen(function* () {
167
166
  const discovery = yield* WorkspaceDiscovery;
168
167
  const detector = yield* PublishabilityDetector;
169
168
  const packages = yield* discovery.listPackages().pipe(Effect.orDie);
170
169
  const out = [];
171
170
  for (const pkg of packages) {
172
- const targets = yield* detector.detect(pkg, root);
171
+ const targets = yield* detector.detect(pkg);
173
172
  if (targets.length > 0) out.push({
174
173
  name: pkg.name,
175
174
  version: pkg.version,
@@ -227,7 +226,7 @@ const readTargetsBinding = (fs, pkgPath) => fs.readFileString(join(pkgPath, "dis
227
226
  catch: () => /* @__PURE__ */ new Error("invalid targets.json")
228
227
  })), Effect.orElseSucceed(() => null));
229
228
  /**
230
- * Override of `workspaces-effect`'s {@link SilkPublishability} Tag with pure silk rules.
229
+ * Override of `@effected/workspaces`' `PublishabilityDetector` Tag with pure silk rules.
231
230
  *
232
231
  * @remarks Requires `FileSystem` (captured at layer build); `detect` reads the raw
233
232
  * `package.json` from `pkg.packageJsonPath` and applies `SilkPublishability.detect`.
@@ -237,7 +236,7 @@ const readTargetsBinding = (fs, pkgPath) => fs.readFileString(join(pkgPath, "dis
237
236
  */
238
237
  const SilkPublishabilityDetectorLive = Layer.effect(PublishabilityDetector, Effect.gen(function* () {
239
238
  const fs = yield* FileSystem.FileSystem;
240
- return { detect: (pkg, _root) => Effect.gen(function* () {
239
+ return { detect: (pkg) => Effect.gen(function* () {
241
240
  const raw = yield* readRaw(fs, pkg.packageJsonPath);
242
241
  if (!raw) return [];
243
242
  const binding = yield* readTargetsBinding(fs, pkg.path);
@@ -245,11 +244,34 @@ const SilkPublishabilityDetectorLive = Layer.effect(PublishabilityDetector, Effe
245
244
  }) };
246
245
  }));
247
246
  /**
248
- * Ignore-aware override of {@link SilkPublishability}. `detect` short-circuits to `[]`
247
+ * The workspace root a package was discovered against, derived from its own
248
+ * coordinates: `relativePath` is the package directory relative to the
249
+ * discovery root (POSIX, `"."` for the root package), so ascending one level
250
+ * per path segment from `pkg.path` lands exactly on that root.
251
+ *
252
+ * @remarks
253
+ * Derivation is deliberate — probing the filesystem for workspace markers
254
+ * (`WorkspaceRoot.find`) can walk PAST the intended root when that root
255
+ * carries no marker (a fixture tree, a bare directory) and land on an
256
+ * enclosing workspace, silently swapping in that outer root's
257
+ * `.changeset/config.json` and dropping the ignore/mode gating (the #209
258
+ * regression class). The discovery root needs no probing: whoever built the
259
+ * `WorkspacePackage` already knew it.
260
+ */
261
+ const packageRoot = (pkg) => {
262
+ const segments = pkg.relativePath.split("/").filter((segment) => segment !== "" && segment !== ".");
263
+ return segments.length === 0 ? pkg.path : join(pkg.path, ...segments.map(() => ".."));
264
+ };
265
+ /**
266
+ * Ignore-aware override of `PublishabilityDetector`. `detect` short-circuits to `[]`
249
267
  * for changeset-ignored packages, then dispatches on `ChangesetConfig.mode`:
250
268
  * `none` → `[]`; `silk` → `SilkPublishability.detect`; `vanilla` → the library default.
251
269
  *
252
- * @remarks Requires `FileSystem` + {@link ChangesetConfig} at build.
270
+ * @remarks Requires `FileSystem` and {@link ChangesetConfig} at build.
271
+ * The kit's `detect` contract no longer receives the workspace root, so the changeset
272
+ * lookups derive it per package from the package's own discovery coordinates
273
+ * (`pkg.path` ascended by `pkg.relativePath` — never a filesystem marker walk,
274
+ * which could escape an unmarked root and read the wrong `.changeset/config.json`).
253
275
  *
254
276
  * @since 0.4.0
255
277
  * @public
@@ -257,8 +279,9 @@ const SilkPublishabilityDetectorLive = Layer.effect(PublishabilityDetector, Effe
257
279
  const PublishabilityDetectorAdaptiveLive = Layer.effect(PublishabilityDetector, Effect.gen(function* () {
258
280
  const fs = yield* FileSystem.FileSystem;
259
281
  const config = yield* ChangesetConfig;
260
- const vanilla = yield* Effect.provide(PublishabilityDetector, PublishabilityDetectorLive);
261
- return { detect: (pkg, root) => Effect.gen(function* () {
282
+ const vanilla = yield* Effect.provide(PublishabilityDetector, PublishabilityDetector.layer);
283
+ return { detect: (pkg) => Effect.gen(function* () {
284
+ const root = packageRoot(pkg);
262
285
  if (yield* config.isIgnored(pkg.name, root)) return [];
263
286
  const mode = yield* config.mode(root);
264
287
  if (mode === "none") return [];
@@ -268,7 +291,7 @@ const PublishabilityDetectorAdaptiveLive = Layer.effect(PublishabilityDetector,
268
291
  const binding = yield* readTargetsBinding(fs, pkg.path);
269
292
  return SilkPublishability.detect(pkg.name, raw, binding);
270
293
  }
271
- return yield* vanilla.detect(pkg, root);
294
+ return yield* vanilla.detect(pkg);
272
295
  }) };
273
296
  }));
274
297