@savvy-web/silk-effects 0.2.2 → 0.4.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/index.d.ts CHANGED
@@ -18,28 +18,69 @@ import { Equal } from 'effect';
18
18
  import { FileSystem } from '@effect/platform';
19
19
  import { Hash } from 'effect';
20
20
  import { Layer } from 'effect';
21
+ import { Option } from 'effect';
21
22
  import { PackageManagerDetector } from 'workspaces-effect';
22
23
  import type { PlatformError } from '@effect/platform/Error';
24
+ import { PublishabilityDetector } from 'workspaces-effect';
25
+ import { PublishConfig } from 'workspaces-effect';
26
+ import { PublishTarget } from 'workspaces-effect';
23
27
  import { Schema } from 'effect';
24
28
  import type { Stream } from 'effect';
29
+ import { TopologicalSorter } from 'workspaces-effect';
25
30
  import { Unify } from 'effect/Unify';
26
31
  import { VoidIfEmpty } from 'effect/Types';
32
+ import { WorkspaceDiscovery } from 'workspaces-effect';
33
+ import type { WorkspacePackage } from 'workspaces-effect';
27
34
  import { WorkspaceRoot } from 'workspaces-effect';
28
35
  import { YieldableError } from 'effect/Cause';
29
36
 
30
37
  /**
31
- * Authentication strategy used to obtain publish credentials.
38
+ * A fully analyzed workspace with publish targets, versioning status,
39
+ * and release group membership.
32
40
  *
33
- * @remarks
34
- * `"oidc"` relies on GitHub Actions OIDC provenance tokens (no explicit secret needed).
35
- * `"token"` reads a long-lived token from an environment variable.
36
- *
37
- * @since 0.1.0
41
+ * @since 0.2.0
38
42
  */
39
- export declare const AuthStrategy: Schema.Literal<["oidc", "token"]>;
43
+ export declare class AnalyzedWorkspace extends AnalyzedWorkspace_base {
44
+ get isRoot(): boolean;
45
+ get isPublishable(): boolean;
46
+ get isReleasable(): boolean;
47
+ get isFixed(): boolean;
48
+ get isLinked(): boolean;
49
+ publishesTo(registry: string): boolean;
50
+ hasTarget(shorthand: "npm" | "github" | "jsr"): boolean;
51
+ targetFor(registry: string): Option.Option<PublishTarget>;
52
+ [Equal.symbol](that: Equal.Equal): boolean;
53
+ [Hash.symbol](): number;
54
+ toString(): string;
55
+ toJSON(): unknown;
56
+ static publishable(workspaces: ReadonlyArray<AnalyzedWorkspace>): ReadonlyArray<AnalyzedWorkspace>;
57
+ static releasable(workspaces: ReadonlyArray<AnalyzedWorkspace>): ReadonlyArray<AnalyzedWorkspace>;
58
+ static findByName: {
59
+ (name: string): (workspaces: ReadonlyArray<AnalyzedWorkspace>) => Option.Option<AnalyzedWorkspace>;
60
+ (workspaces: ReadonlyArray<AnalyzedWorkspace>, name: string): Option.Option<AnalyzedWorkspace>;
61
+ };
62
+ /** Pretty-print an AnalyzedWorkspace instance. */
63
+ static pretty: (self: AnalyzedWorkspace) => string;
64
+ }
40
65
 
41
- /** @since 0.1.0 */
42
- export declare type AuthStrategy = typeof AuthStrategy.Type;
66
+ declare const AnalyzedWorkspace_base: Schema.TaggedClass<AnalyzedWorkspace, "AnalyzedWorkspace", {
67
+ readonly _tag: Schema.tag<"AnalyzedWorkspace">;
68
+ } & {
69
+ name: typeof Schema.String;
70
+ version: Schema.Struct<{
71
+ current: typeof Schema.String;
72
+ }>;
73
+ path: typeof Schema.String;
74
+ root: typeof Schema.Boolean;
75
+ publishConfig: Schema.NullOr<typeof SilkPublishConfig>;
76
+ publishable: typeof Schema.Boolean;
77
+ targets: Schema.Array$<typeof PublishTarget>;
78
+ versioned: typeof Schema.Boolean;
79
+ tagged: typeof Schema.Boolean;
80
+ released: typeof Schema.Boolean;
81
+ linked: Schema.Array$<Schema.suspend<unknown, unknown, unknown>>;
82
+ fixed: Schema.Array$<Schema.suspend<unknown, unknown, unknown>>;
83
+ }>;
43
84
 
44
85
  /**
45
86
  * Service that keeps the `$schema` URL in Biome config files in sync with a target version.
@@ -178,28 +219,32 @@ export declare type BiomeSyncResult = typeof BiomeSyncResult.Type;
178
219
  export declare function buildSchemaUrl(version: string): string;
179
220
 
180
221
  /**
181
- * Standard changesets configuration matching the `@changesets/types` upstream spec.
222
+ * Accessor service over a workspace root's `.changeset/config.json`.
182
223
  *
183
224
  * @remarks
184
- * Represents the parsed `.changeset/config.json` file. All fields are optional
185
- * to allow partial configs. Use {@link SilkChangesetConfig} when the Silk changelog
186
- * adapter is detected.
225
+ * Reads through {@link ChangesetConfigReader} (FileSystem-based) with a per-root cache.
226
+ * Every accessor is total (error channel `never`): a missing or unreadable config collapses
227
+ * to `mode: "none"` and empty/false defaults.
187
228
  *
188
- * @since 0.1.0
229
+ * @since 0.4.0
189
230
  */
190
- export declare const ChangesetConfig: Schema.Struct<{
191
- changelog: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.Unknown>]>>;
192
- commit: Schema.optional<typeof Schema.Boolean>;
193
- fixed: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
194
- linked: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
195
- access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
196
- baseBranch: Schema.optional<typeof Schema.String>;
197
- updateInternalDependencies: Schema.optional<Schema.Literal<["patch", "minor", "major"]>>;
198
- ignore: Schema.optional<Schema.Array$<typeof Schema.String>>;
199
- }>;
231
+ export declare class ChangesetConfig extends ChangesetConfig_base {
232
+ /**
233
+ * The one ignore matcher: exact name match, or `@scope/*` wildcard.
234
+ *
235
+ * `"@scope/*"` matches `"@scope/anything"` (prefix kept includes the trailing slash),
236
+ * but not the bare scope `"@scope"`.
237
+ */
238
+ static matches(name: string, pattern: string): boolean;
239
+ }
200
240
 
201
- /** @since 0.1.0 */
202
- export declare type ChangesetConfig = typeof ChangesetConfig.Type;
241
+ declare const ChangesetConfig_base: Context.TagClass<ChangesetConfig, "@savvy-web/silk-effects/ChangesetConfig", {
242
+ readonly mode: (root: string) => Effect.Effect<ChangesetMode>;
243
+ readonly versionPrivate: (root: string) => Effect.Effect<boolean>;
244
+ readonly ignorePatterns: (root: string) => Effect.Effect<ReadonlyArray<string>>;
245
+ readonly isIgnored: (name: string, root: string) => Effect.Effect<boolean>;
246
+ readonly fixed: (root: string) => Effect.Effect<ReadonlyArray<ReadonlyArray<string>>>;
247
+ }>;
203
248
 
204
249
  /**
205
250
  * Raised when the `.changeset/config.json` file cannot be read or decoded.
@@ -221,13 +266,59 @@ declare const ChangesetConfigError_base: new <A extends Record<string, any> = {}
221
266
  readonly _tag: "ChangesetConfigError";
222
267
  } & Readonly<A>;
223
268
 
269
+ /**
270
+ * Standard changesets configuration matching the `@changesets/config@3.1.1` spec.
271
+ *
272
+ * @remarks
273
+ * Represents the parsed `.changeset/config.json` file. All fields are optional
274
+ * to allow partial configs. Use {@link SilkChangesetConfigFile} when the Silk changelog
275
+ * adapter is detected.
276
+ *
277
+ * @since 0.1.0
278
+ */
279
+ export declare const ChangesetConfigFile: Schema.Struct<{
280
+ changelog: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.Unknown>, Schema.Literal<[false]>]>>;
281
+ commit: Schema.optional<Schema.Union<[typeof Schema.Boolean, typeof Schema.String, Schema.Array$<typeof Schema.Unknown>]>>;
282
+ fixed: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
283
+ linked: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
284
+ access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
285
+ baseBranch: Schema.optional<typeof Schema.String>;
286
+ updateInternalDependencies: Schema.optional<Schema.Literal<["patch", "minor", "major"]>>;
287
+ ignore: Schema.optional<Schema.Array$<typeof Schema.String>>;
288
+ privatePackages: Schema.optional<Schema.Union<[Schema.Struct<{
289
+ tag: Schema.optional<typeof Schema.Boolean>;
290
+ version: Schema.optional<typeof Schema.Boolean>;
291
+ }>, Schema.Literal<[false]>]>>;
292
+ prettier: Schema.optional<typeof Schema.Boolean>;
293
+ changedFilePatterns: Schema.optional<Schema.Array$<typeof Schema.String>>;
294
+ bumpVersionsWithWorkspaceProtocolOnly: Schema.optional<typeof Schema.Boolean>;
295
+ snapshot: Schema.optional<Schema.Struct<{
296
+ useCalculatedVersion: Schema.optional<typeof Schema.Boolean>;
297
+ prereleaseTemplate: Schema.optional<typeof Schema.String>;
298
+ }>>;
299
+ }>;
300
+
301
+ /** @since 0.1.0 */
302
+ export declare type ChangesetConfigFile = typeof ChangesetConfigFile.Type;
303
+
304
+ /**
305
+ * Live {@link ChangesetConfig} reading via {@link ChangesetConfigReader}, cached per root.
306
+ *
307
+ * @remarks
308
+ * Requires `ChangesetConfigReader` (which requires `FileSystem`). Provide
309
+ * `ChangesetConfigReaderLive` + a platform layer (`NodeContext.layer`).
310
+ *
311
+ * @since 0.4.0
312
+ */
313
+ export declare const ChangesetConfigLive: Layer.Layer<ChangesetConfig, never, ChangesetConfigReader>;
314
+
224
315
  /**
225
316
  * Service that reads and decodes the `.changeset/config.json` for a given workspace root.
226
317
  *
227
318
  * @remarks
228
319
  * Automatically detects whether the config uses the Silk changelog adapter
229
- * (`@savvy-web/changesets`) and decodes as {@link SilkChangesetConfig} or the
230
- * standard {@link ChangesetConfig} accordingly.
320
+ * (`@savvy-web/changesets`) and decodes as {@link SilkChangesetConfigFile} or the
321
+ * standard {@link ChangesetConfigFile} accordingly.
231
322
  *
232
323
  * @example
233
324
  * ```typescript
@@ -256,7 +347,7 @@ declare const ChangesetConfigReader_base: Context.TagClass<ChangesetConfigReader
256
347
  *
257
348
  * @since 0.1.0
258
349
  */
259
- readonly read: (root: string) => Effect.Effect<ChangesetConfig | SilkChangesetConfig, ChangesetConfigError>;
350
+ readonly read: (root: string) => Effect.Effect<ChangesetConfigFile | SilkChangesetConfigFile, ChangesetConfigError>;
260
351
  }>;
261
352
 
262
353
  /**
@@ -270,6 +361,9 @@ declare const ChangesetConfigReader_base: Context.TagClass<ChangesetConfigReader
270
361
  */
271
362
  export declare const ChangesetConfigReaderLive: Layer.Layer<ChangesetConfigReader, never, FileSystem.FileSystem>;
272
363
 
364
+ /** Changeset operating mode for a workspace root. */
365
+ export declare type ChangesetMode = "silk" | "vanilla" | "none";
366
+
273
367
  /** @since 0.2.0 */
274
368
  export declare type CheckResult = Data.TaggedEnum<CheckResultDefinition>;
275
369
 
@@ -546,104 +640,48 @@ declare const ManagedSection_base: Context.TagClass<ManagedSection, "@savvy-web/
546
640
  export declare const ManagedSectionLive: Layer.Layer<ManagedSection, never, FileSystem.FileSystem>;
547
641
 
548
642
  /**
549
- * Raised when the `publishConfig` field in a `package.json` is present but invalid.
643
+ * Ignore-aware override of {@link PublishabilityDetector}. `detect` short-circuits to `[]`
644
+ * for changeset-ignored packages, then dispatches on {@link ChangesetConfig.mode}:
645
+ * `none` → `[]`; `silk` → {@link SilkPublishability.detect}; `vanilla` → the library default.
550
646
  *
551
- * @remarks
552
- * Returned by {@link SilkPublishabilityPlugin.detect} when `publishConfig` exists
553
- * but cannot be mapped to a valid set of publish targets.
647
+ * @remarks Requires `FileSystem` + {@link ChangesetConfig} at build.
554
648
  *
555
- * @since 0.1.0
649
+ * @since 0.4.0
556
650
  */
557
- export declare class PublishConfigError extends PublishConfigError_base<{
558
- readonly packageName: string;
559
- readonly reason: string;
560
- }> {
561
- get message(): string;
562
- }
563
-
564
- declare const PublishConfigError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
565
- readonly _tag: "PublishConfigError";
566
- } & Readonly<A>;
567
-
568
- /**
569
- * The publish protocol used when pushing a package to a registry.
570
- *
571
- * @remarks
572
- * `"npm"` covers all npm-compatible registries (npmjs.org, GitHub Packages, custom).
573
- * `"jsr"` targets the JSR registry via its own publish tool.
574
- *
575
- * @since 0.1.0
576
- */
577
- export declare const PublishProtocol: Schema.Literal<["npm", "jsr"]>;
578
-
579
- /** @since 0.1.0 */
580
- export declare type PublishProtocol = typeof PublishProtocol.Type;
581
-
582
- /**
583
- * Union of all accepted publish-target representations.
584
- *
585
- * @remarks
586
- * Accepts a {@link PublishTargetShorthand} string (`"npm"`, `"github"`, `"jsr"`),
587
- * an `https://` URL pointing to a custom npm-compatible registry, or a full
588
- * {@link PublishTargetObject} with explicit field overrides.
589
- *
590
- * @since 0.1.0
591
- */
592
- declare const PublishTarget: Schema.Union<[Schema.Literal<["npm", "github", "jsr"]>, Schema.filter<typeof Schema.String>, Schema.Struct<{
593
- protocol: Schema.optionalWith<Schema.Literal<["npm", "jsr"]>, {
594
- default: () => "npm";
595
- }>;
596
- registry: Schema.optional<typeof Schema.String>;
597
- directory: Schema.optional<typeof Schema.String>;
598
- access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
599
- provenance: Schema.optional<typeof Schema.Boolean>;
600
- tag: Schema.optional<typeof Schema.String>;
601
- }>]>;
602
-
603
- /** @since 0.1.0 */
604
- declare type PublishTarget = typeof PublishTarget.Type;
605
- export { PublishTarget }
606
- export { PublishTarget as PublishTargetSchema }
651
+ export declare const PublishabilityDetectorAdaptiveLive: Layer.Layer<PublishabilityDetector, never, FileSystem.FileSystem | ChangesetConfig>;
607
652
 
608
- /**
609
- * Full publish-target configuration expressed as a structured object.
610
- *
611
- * @remarks
612
- * All fields are optional and fall back to sensible defaults when omitted.
613
- * `protocol` defaults to `"npm"`. `access` defaults to the registry default.
614
- *
615
- * @since 0.1.0
616
- */
617
- export declare const PublishTargetObject: Schema.Struct<{
618
- protocol: Schema.optionalWith<Schema.Literal<["npm", "jsr"]>, {
619
- default: () => "npm";
620
- }>;
621
- registry: Schema.optional<typeof Schema.String>;
622
- directory: Schema.optional<typeof Schema.String>;
623
- access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
624
- provenance: Schema.optional<typeof Schema.Boolean>;
625
- tag: Schema.optional<typeof Schema.String>;
626
- }>;
653
+ /** A publishable workspace package and the count of its resolved publish targets. */
654
+ export declare interface PublishablePackage {
655
+ readonly name: string;
656
+ readonly version: string;
657
+ readonly path: string;
658
+ readonly targetCount: number;
659
+ }
627
660
 
628
- /** @since 0.1.0 */
629
- export declare type PublishTargetObject = typeof PublishTargetObject.Type;
661
+ /** Raw `package.json` shape consumed by {@link SilkPublishability.detect}. */
662
+ export declare interface RawPackageJson {
663
+ readonly name?: string;
664
+ readonly version?: string;
665
+ readonly private?: boolean;
666
+ readonly publishConfig?: RawPublishConfig;
667
+ }
630
668
 
631
- /**
632
- * Shorthand string identifiers for common publish destinations.
633
- *
634
- * @remarks
635
- * - `"npm"` — the public npm registry, authenticated via OIDC.
636
- * - `"github"` — GitHub Packages, authenticated via `GITHUB_TOKEN`.
637
- * - `"jsr"` — the JSR registry, authenticated via OIDC.
638
- *
639
- * @since 0.1.0
640
- */
641
- declare const PublishTargetShorthand: Schema.Literal<["npm", "github", "jsr"]>;
669
+ /** Raw `publishConfig` shape (the unschematized fields silk rules consult). */
670
+ export declare interface RawPublishConfig {
671
+ readonly access?: "public" | "restricted";
672
+ readonly registry?: string;
673
+ readonly directory?: string;
674
+ readonly targets?: ReadonlyArray<RawTargetSpec>;
675
+ }
642
676
 
643
- /** @since 0.1.0 */
644
- declare type PublishTargetShorthand = typeof PublishTargetShorthand.Type;
645
- export { PublishTargetShorthand }
646
- export { PublishTargetShorthand as PublishTargetShorthandSchema }
677
+ /** A single declared publish target in a raw `publishConfig.targets` array. */
678
+ export declare type RawTargetSpec = string | {
679
+ readonly access?: "public" | "restricted";
680
+ readonly protocol?: string;
681
+ readonly registry?: string;
682
+ readonly directory?: string;
683
+ readonly provenance?: boolean;
684
+ };
647
685
 
648
686
  /** @since 0.2.0 */
649
687
  export declare type ResolutionPolicy = Data.TaggedEnum<ResolutionPolicyDefinition>;
@@ -729,32 +767,6 @@ export declare type ResolutionPolicyDefinition = {
729
767
  readonly RequireMatch: {};
730
768
  };
731
769
 
732
- /**
733
- * Fully resolved publish target with all fields populated and defaults applied.
734
- *
735
- * @remarks
736
- * Produced by {@link TargetResolver.resolve} from any {@link PublishTarget} input.
737
- * All optional fields from {@link PublishTargetObject} become required here,
738
- * and `auth` / `tokenEnv` are derived from the registry URL.
739
- *
740
- * @since 0.1.0
741
- */
742
- declare const ResolvedTarget: Schema.Struct<{
743
- protocol: Schema.Literal<["npm", "jsr"]>;
744
- registry: Schema.NullOr<typeof Schema.String>;
745
- directory: typeof Schema.String;
746
- access: Schema.Literal<["public", "restricted"]>;
747
- provenance: typeof Schema.Boolean;
748
- tag: typeof Schema.String;
749
- auth: Schema.Literal<["oidc", "token"]>;
750
- tokenEnv: Schema.NullOr<typeof Schema.String>;
751
- }>;
752
-
753
- /** @since 0.1.0 */
754
- declare type ResolvedTarget = typeof ResolvedTarget.Type;
755
- export { ResolvedTarget }
756
- export { ResolvedTarget as ResolvedTargetSchema }
757
-
758
770
  /**
759
771
  * Result of resolving a {@link ToolDefinition}.
760
772
  *
@@ -1018,21 +1030,32 @@ declare const ShellSectionDefinition_base: Schema.TaggedClass<ShellSectionDefini
1018
1030
  * Extended changeset config for repos using the `@savvy-web/changesets` changelog adapter.
1019
1031
  *
1020
1032
  * @remarks
1021
- * Extends {@link ChangesetConfig} with a `_isSilk` marker flag that is automatically
1033
+ * Extends {@link ChangesetConfigFile} with a `_isSilk` marker flag that is automatically
1022
1034
  * set to `true`. Detected by {@link ChangesetConfigReader} when the `changelog` field
1023
1035
  * references `@savvy-web/changesets`.
1024
1036
  *
1025
1037
  * @since 0.1.0
1026
1038
  */
1027
- export declare const SilkChangesetConfig: Schema.extend<Schema.Struct<{
1028
- changelog: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.Unknown>]>>;
1029
- commit: Schema.optional<typeof Schema.Boolean>;
1039
+ export declare const SilkChangesetConfigFile: Schema.extend<Schema.Struct<{
1040
+ changelog: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.Unknown>, Schema.Literal<[false]>]>>;
1041
+ commit: Schema.optional<Schema.Union<[typeof Schema.Boolean, typeof Schema.String, Schema.Array$<typeof Schema.Unknown>]>>;
1030
1042
  fixed: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
1031
1043
  linked: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
1032
1044
  access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
1033
1045
  baseBranch: Schema.optional<typeof Schema.String>;
1034
1046
  updateInternalDependencies: Schema.optional<Schema.Literal<["patch", "minor", "major"]>>;
1035
1047
  ignore: Schema.optional<Schema.Array$<typeof Schema.String>>;
1048
+ privatePackages: Schema.optional<Schema.Union<[Schema.Struct<{
1049
+ tag: Schema.optional<typeof Schema.Boolean>;
1050
+ version: Schema.optional<typeof Schema.Boolean>;
1051
+ }>, Schema.Literal<[false]>]>>;
1052
+ prettier: Schema.optional<typeof Schema.Boolean>;
1053
+ changedFilePatterns: Schema.optional<Schema.Array$<typeof Schema.String>>;
1054
+ bumpVersionsWithWorkspaceProtocolOnly: Schema.optional<typeof Schema.Boolean>;
1055
+ snapshot: Schema.optional<Schema.Struct<{
1056
+ useCalculatedVersion: Schema.optional<typeof Schema.Boolean>;
1057
+ prereleaseTemplate: Schema.optional<typeof Schema.String>;
1058
+ }>>;
1036
1059
  }>, Schema.Struct<{
1037
1060
  _isSilk: Schema.optionalWith<typeof Schema.Boolean, {
1038
1061
  default: () => true;
@@ -1040,59 +1063,180 @@ export declare const SilkChangesetConfig: Schema.extend<Schema.Struct<{
1040
1063
  }>>;
1041
1064
 
1042
1065
  /** @since 0.1.0 */
1043
- export declare type SilkChangesetConfig = typeof SilkChangesetConfig.Type;
1066
+ export declare type SilkChangesetConfigFile = typeof SilkChangesetConfigFile.Type;
1067
+
1068
+ /**
1069
+ * Silk publishability rules over `workspaces-effect`'s {@link PublishTarget}.
1070
+ *
1071
+ * @remarks
1072
+ * In silk mode `private: true` is the norm on workspace `package.json`; publishability is
1073
+ * derived from `publishConfig`, with the `private` flag consulted only as a last-resort
1074
+ * default. All helpers are static so a consumer sees the full rule surface in one place.
1075
+ *
1076
+ * @since 0.4.0
1077
+ */
1078
+ export declare class SilkPublishability {
1079
+ /**
1080
+ * Resolve the access for one target spec. String targets always inherit the parent
1081
+ * `publishConfig.access`; object targets use their own `.access` else the parent's.
1082
+ */
1083
+ static resolveTargetAccess(target: RawTargetSpec, parentAccess: "public" | "restricted" | undefined): "public" | "restricted" | undefined;
1084
+ /**
1085
+ * Expand a shorthand string target to a registry URL. `"npm"`/`"github"`/`"jsr"` map to
1086
+ * canonical registries; `http(s)://…` is verbatim; anything else falls back to the parent
1087
+ * `publishConfig.registry` (or the npm default).
1088
+ */
1089
+ static expandShorthand(target: string, parentRegistry: string | undefined): string;
1090
+ /**
1091
+ * Apply silk publishability rules to a raw `package.json`. Targets-first precedence:
1092
+ * `publishConfig.targets` → one PublishTarget per surviving target (regardless of
1093
+ * `private`); else `publishConfig.access` → one target; else `private !== true` → one
1094
+ * default target; else `[]`.
1095
+ */
1096
+ static detect(pkgName: string, raw: RawPackageJson): ReadonlyArray<PublishTarget>;
1097
+ /**
1098
+ * Resolve a package's publish targets via {@link PublishabilityDetector}, then drop any
1099
+ * whose built `directory` package.json is `private: true`. Returned targets keep the
1100
+ * detector's original (possibly package-relative) `directory`.
1101
+ */
1102
+ static resolveTargets(pkg: WorkspacePackage, root: string): Effect.Effect<ReadonlyArray<PublishTarget>, never, PublishabilityDetector | FileSystem.FileSystem>;
1103
+ /**
1104
+ * The publishable, non-ignored packages, resolved through the single
1105
+ * {@link PublishabilityDetector} (which already honors changeset ignore in adaptive mode).
1106
+ */
1107
+ static listPublishable(root: string): Effect.Effect<ReadonlyArray<PublishablePackage>, never, WorkspaceDiscovery | PublishabilityDetector>;
1108
+ }
1044
1109
 
1045
1110
  /**
1046
- * Service that determines whether a package is publishable and resolves its targets.
1111
+ * Override of `workspaces-effect`'s {@link PublishabilityDetector} Tag with pure silk rules.
1112
+ *
1113
+ * @remarks Requires `FileSystem` (captured at layer build); `detect` reads the raw
1114
+ * `package.json` from `pkg.packageJsonPath` and applies {@link SilkPublishability.detect}.
1115
+ *
1116
+ * @since 0.4.0
1117
+ */
1118
+ export declare const SilkPublishabilityDetectorLive: Layer.Layer<PublishabilityDetector, never, FileSystem.FileSystem>;
1119
+
1120
+ /**
1121
+ * Silk-extended publishConfig schema.
1047
1122
  *
1048
1123
  * @remarks
1049
- * Inspects the `package.json` object using the Silk publishability rules:
1050
- * - `private: true` with no `publishConfig` not publishable (empty array).
1051
- * - `publishConfig` without `access` or `targets` → not publishable.
1052
- * - `publishConfig.targets` (array) → resolved via {@link TargetResolver}.
1053
- * - `publishConfig.registry` → resolved as a single registry target.
1054
- * - Default → resolved as `"npm"`.
1124
+ * Extends the base PublishConfig from workspaces-effect (which covers npm
1125
+ * standard fields: access, registry, directory, tag, linkDirectory) with the
1126
+ * Silk `targets` extension for multi-registry publishing.
1127
+ *
1128
+ * @since 0.2.0
1129
+ */
1130
+ export declare class SilkPublishConfig extends SilkPublishConfig_base {
1131
+ }
1132
+
1133
+ declare const SilkPublishConfig_base: Schema.Class<SilkPublishConfig, {
1134
+ access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
1135
+ registry: Schema.optional<typeof Schema.String>;
1136
+ directory: Schema.optional<typeof Schema.String>;
1137
+ tag: Schema.optional<typeof Schema.String>;
1138
+ linkDirectory: Schema.optional<typeof Schema.Boolean>;
1139
+ } & {
1140
+ targets: Schema.optional<Schema.Array$<Schema.Union<[Schema.Literal<["npm", "github", "jsr"]>, Schema.Struct<{
1141
+ protocol: Schema.optionalWith<Schema.Literal<["npm", "jsr"]>, {
1142
+ default: () => "npm";
1143
+ }>;
1144
+ registry: Schema.optional<typeof Schema.String>;
1145
+ directory: Schema.optional<typeof Schema.String>;
1146
+ access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
1147
+ provenance: Schema.optional<typeof Schema.Boolean>;
1148
+ tag: Schema.optional<typeof Schema.String>;
1149
+ }>]>>>;
1150
+ }, {} & {
1151
+ readonly access?: "public" | "restricted" | undefined;
1152
+ readonly directory?: string | undefined;
1153
+ readonly linkDirectory?: boolean | undefined;
1154
+ readonly registry?: string | undefined;
1155
+ readonly tag?: string | undefined;
1156
+ } & {} & {
1157
+ readonly targets?: readonly ("github" | "jsr" | "npm" | {
1158
+ readonly access?: "public" | "restricted" | undefined;
1159
+ readonly directory?: string | undefined;
1160
+ readonly protocol?: "jsr" | "npm" | undefined;
1161
+ readonly provenance?: boolean | undefined;
1162
+ readonly registry?: string | undefined;
1163
+ readonly tag?: string | undefined;
1164
+ })[] | undefined;
1165
+ }, never, {
1166
+ readonly access?: "public" | "restricted" | undefined;
1167
+ } & {
1168
+ readonly directory?: string | undefined;
1169
+ } & {
1170
+ readonly linkDirectory?: boolean | undefined;
1171
+ } & {
1172
+ readonly registry?: string | undefined;
1173
+ } & {
1174
+ readonly tag?: string | undefined;
1175
+ } & {
1176
+ readonly targets?: readonly ("github" | "jsr" | "npm" | {
1177
+ readonly protocol: "jsr" | "npm";
1178
+ readonly registry?: string | undefined;
1179
+ readonly directory?: string | undefined;
1180
+ readonly access?: "public" | "restricted" | undefined;
1181
+ readonly provenance?: boolean | undefined;
1182
+ readonly tag?: string | undefined;
1183
+ })[] | undefined;
1184
+ }, PublishConfig, {}>;
1185
+
1186
+ /**
1187
+ * Service that performs a full workspace analysis — discovering packages,
1188
+ * detecting publishability, computing versioning/tag strategies, and
1189
+ * wiring up fixed/linked release groups.
1190
+ *
1191
+ * @remarks
1192
+ * Orchestrates {@link WorkspaceDiscovery}, {@link PackageManagerDetector},
1193
+ * {@link ChangesetConfigReader}, {@link VersioningStrategy}, and
1194
+ * {@link TagStrategy} to produce a complete {@link WorkspaceAnalysis} for a
1195
+ * given workspace root.
1055
1196
  *
1056
1197
  * @example
1057
1198
  * ```typescript
1058
1199
  * const result = await Effect.runPromise(
1059
1200
  * Effect.gen(function* () {
1060
- * const plugin = yield* SilkPublishabilityPlugin;
1061
- * return yield* plugin.detect({ publishConfig: { access: "public" } });
1201
+ * const analyzer = yield* SilkWorkspaceAnalyzer;
1202
+ * return yield* analyzer.analyze("/path/to/monorepo");
1062
1203
  * }).pipe(
1063
- * Effect.provide(SilkPublishabilityPluginLive),
1064
- * Effect.provide(TargetResolverLive),
1204
+ * Effect.provide(SilkWorkspaceAnalyzerLive),
1205
+ * // ... provide all transitive layers
1065
1206
  * )
1066
1207
  * );
1067
1208
  * ```
1068
1209
  *
1069
- * @since 0.1.0
1210
+ * @since 0.2.0
1070
1211
  */
1071
- export declare class SilkPublishabilityPlugin extends SilkPublishabilityPlugin_base {
1212
+ export declare class SilkWorkspaceAnalyzer extends SilkWorkspaceAnalyzer_base {
1072
1213
  }
1073
1214
 
1074
- declare const SilkPublishabilityPlugin_base: Context.TagClass<SilkPublishabilityPlugin, "@savvy-web/silk-effects/SilkPublishabilityPlugin", {
1215
+ declare const SilkWorkspaceAnalyzer_base: Context.TagClass<SilkWorkspaceAnalyzer, "@savvy-web/silk-effects/SilkWorkspaceAnalyzer", {
1075
1216
  /**
1076
- * Inspect a parsed `package.json` object and return the resolved publish targets.
1217
+ * Analyze a workspace root and produce a full {@link WorkspaceAnalysis}.
1077
1218
  *
1078
- * @param pkgJson - The parsed `package.json` contents.
1079
- * @returns An `Effect` that succeeds with an array of {@link ResolvedTarget} records
1080
- * (empty when the package is not publishable), or fails with {@link TargetResolutionError}.
1219
+ * @param root - Absolute path to the workspace root directory. Must match
1220
+ * the root that the `WorkspaceRoot` layer was initialised with. The analyzer
1221
+ * is single-root by design build a fresh layer per workspace root.
1222
+ * @returns An `Effect` that succeeds with a {@link WorkspaceAnalysis}, or
1223
+ * fails with {@link WorkspaceAnalysisError}.
1081
1224
  *
1082
- * @since 0.1.0
1225
+ * @since 0.2.0
1083
1226
  */
1084
- readonly detect: (pkgJson: Record<string, unknown>) => Effect.Effect<ReadonlyArray<ResolvedTarget>, TargetResolutionError>;
1227
+ readonly analyze: (root: string) => Effect.Effect<WorkspaceAnalysis, WorkspaceAnalysisError>;
1085
1228
  }>;
1086
1229
 
1087
1230
  /**
1088
- * Live implementation of {@link SilkPublishabilityPlugin}.
1231
+ * Live implementation of {@link SilkWorkspaceAnalyzer}.
1089
1232
  *
1090
1233
  * @remarks
1091
- * Requires {@link TargetResolver} to resolve target strings and objects.
1234
+ * Requires {@link WorkspaceDiscovery}, {@link PackageManagerDetector},
1235
+ * {@link ChangesetConfigReader}, {@link VersioningStrategy}, and {@link TagStrategy}.
1092
1236
  *
1093
- * @since 0.1.0
1237
+ * @since 0.2.0
1094
1238
  */
1095
- export declare const SilkPublishabilityPluginLive: Layer.Layer<SilkPublishabilityPlugin, never, TargetResolver>;
1239
+ export declare const SilkWorkspaceAnalyzerLive: Layer.Layer<SilkWorkspaceAnalyzer, never, FileSystem.FileSystem | WorkspaceDiscovery | TopologicalSorter | PackageManagerDetector | ChangesetConfigReader | VersioningStrategy | TagStrategy>;
1096
1240
 
1097
1241
  /** @since 0.2.0 */
1098
1242
  export declare type SourceRequirement = Data.TaggedEnum<SourceRequirementDefinition>;
@@ -1354,72 +1498,6 @@ export declare const TagStrategyType: Schema.Literal<["single", "scoped"]>;
1354
1498
  /** @since 0.1.0 */
1355
1499
  export declare type TagStrategyType = typeof TagStrategyType.Type;
1356
1500
 
1357
- /**
1358
- * Raised when a publish target value cannot be resolved into a {@link ResolvedTarget}.
1359
- *
1360
- * @remarks
1361
- * Returned by {@link TargetResolver.resolve} when the input is not a recognised shorthand,
1362
- * a valid `https://` URL, or a well-formed object target.
1363
- *
1364
- * @since 0.1.0
1365
- */
1366
- export declare class TargetResolutionError extends TargetResolutionError_base<{
1367
- readonly target: unknown;
1368
- readonly reason: string;
1369
- }> {
1370
- get message(): string;
1371
- }
1372
-
1373
- declare const TargetResolutionError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
1374
- readonly _tag: "TargetResolutionError";
1375
- } & Readonly<A>;
1376
-
1377
- /**
1378
- * Service that resolves raw publish-target values into fully-normalised {@link ResolvedTarget} records.
1379
- *
1380
- * @remarks
1381
- * Accepts a single target or an array of targets. Each item may be a
1382
- * {@link PublishTargetShorthand} string, an `https://` registry URL, or a
1383
- * {@link PublishTargetObject}. Unknown values produce a {@link TargetResolutionError}.
1384
- *
1385
- * @example
1386
- * ```typescript
1387
- * const result = await Effect.runPromise(
1388
- * Effect.gen(function* () {
1389
- * const resolver = yield* TargetResolver;
1390
- * return yield* resolver.resolve("npm");
1391
- * }).pipe(Effect.provide(TargetResolverLive))
1392
- * );
1393
- * ```
1394
- *
1395
- * @since 0.1.0
1396
- */
1397
- export declare class TargetResolver extends TargetResolver_base {
1398
- }
1399
-
1400
- declare const TargetResolver_base: Context.TagClass<TargetResolver, "@savvy-web/silk-effects/TargetResolver", {
1401
- /**
1402
- * Resolve one target (or an array of targets) into an array of {@link ResolvedTarget} records.
1403
- *
1404
- * @param target - A single publish-target value or an array of them.
1405
- * @returns An `Effect` that succeeds with the resolved targets or fails with {@link TargetResolutionError}.
1406
- *
1407
- * @since 0.1.0
1408
- */
1409
- readonly resolve: (target: unknown) => Effect.Effect<ReadonlyArray<ResolvedTarget>, TargetResolutionError>;
1410
- }>;
1411
-
1412
- /**
1413
- * Live implementation of {@link TargetResolver} with no external dependencies.
1414
- *
1415
- * @remarks
1416
- * All resolution logic is pure: shorthand strings, `https://` URLs, and object targets
1417
- * are mapped to {@link ResolvedTarget} records without any I/O.
1418
- *
1419
- * @since 0.1.0
1420
- */
1421
- export declare const TargetResolverLive: Layer.Layer<TargetResolver, never, never>;
1422
-
1423
1501
  /**
1424
1502
  * Wraps `@effect/platform` {@link Command.Command} with instance method ergonomics.
1425
1503
  *
@@ -1782,4 +1860,110 @@ export declare const VersioningStrategyType: Schema.Literal<["single", "fixed-gr
1782
1860
  /** @since 0.1.0 */
1783
1861
  export declare type VersioningStrategyType = typeof VersioningStrategyType.Type;
1784
1862
 
1863
+ /**
1864
+ * Full workspace analysis result containing all analyzed workspaces
1865
+ * and project-level configuration.
1866
+ *
1867
+ * @since 0.2.0
1868
+ */
1869
+ export declare class WorkspaceAnalysis extends WorkspaceAnalysis_base {
1870
+ findWorkspace(name: string): Option.Option<AnalyzedWorkspace>;
1871
+ get rootWorkspace(): Option.Option<AnalyzedWorkspace>;
1872
+ get publishableWorkspaces(): ReadonlyArray<AnalyzedWorkspace>;
1873
+ get versionedWorkspaces(): ReadonlyArray<AnalyzedWorkspace>;
1874
+ get taggedWorkspaces(): ReadonlyArray<AnalyzedWorkspace>;
1875
+ get releasableWorkspaces(): ReadonlyArray<AnalyzedWorkspace>;
1876
+ get isSilk(): boolean;
1877
+ get hasChangesets(): boolean;
1878
+ [Equal.symbol](that: Equal.Equal): boolean;
1879
+ [Hash.symbol](): number;
1880
+ toString(): string;
1881
+ /** Pretty-print a WorkspaceAnalysis instance. */
1882
+ static pretty: (self: WorkspaceAnalysis) => string;
1883
+ }
1884
+
1885
+ declare const WorkspaceAnalysis_base: Schema.TaggedClass<WorkspaceAnalysis, "WorkspaceAnalysis", {
1886
+ readonly _tag: Schema.tag<"WorkspaceAnalysis">;
1887
+ } & {
1888
+ root: typeof Schema.String;
1889
+ runtime: Schema.Literal<["node", "bun"]>;
1890
+ packageManager: Schema.Struct<{
1891
+ type: Schema.Literal<["npm", "pnpm", "yarn", "bun"]>;
1892
+ version: Schema.optional<typeof Schema.String>;
1893
+ }>;
1894
+ workspaces: Schema.Array$<typeof AnalyzedWorkspace>;
1895
+ changesetConfig: Schema.NullOr<Schema.Union<[Schema.extend<Schema.Struct<{
1896
+ changelog: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.Unknown>, Schema.Literal<[false]>]>>;
1897
+ commit: Schema.optional<Schema.Union<[typeof Schema.Boolean, typeof Schema.String, Schema.Array$<typeof Schema.Unknown>]>>;
1898
+ fixed: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
1899
+ linked: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
1900
+ access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
1901
+ baseBranch: Schema.optional<typeof Schema.String>;
1902
+ updateInternalDependencies: Schema.optional<Schema.Literal<["patch", "minor", "major"]>>;
1903
+ ignore: Schema.optional<Schema.Array$<typeof Schema.String>>;
1904
+ privatePackages: Schema.optional<Schema.Union<[Schema.Struct<{
1905
+ tag: Schema.optional<typeof Schema.Boolean>;
1906
+ version: Schema.optional<typeof Schema.Boolean>;
1907
+ }>, Schema.Literal<[false]>]>>;
1908
+ prettier: Schema.optional<typeof Schema.Boolean>;
1909
+ changedFilePatterns: Schema.optional<Schema.Array$<typeof Schema.String>>;
1910
+ bumpVersionsWithWorkspaceProtocolOnly: Schema.optional<typeof Schema.Boolean>;
1911
+ snapshot: Schema.optional<Schema.Struct<{
1912
+ useCalculatedVersion: Schema.optional<typeof Schema.Boolean>;
1913
+ prereleaseTemplate: Schema.optional<typeof Schema.String>;
1914
+ }>>;
1915
+ }>, Schema.Struct<{
1916
+ _isSilk: Schema.optionalWith<typeof Schema.Boolean, {
1917
+ default: () => true;
1918
+ }>;
1919
+ }>>, Schema.Struct<{
1920
+ changelog: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Array$<typeof Schema.Unknown>, Schema.Literal<[false]>]>>;
1921
+ commit: Schema.optional<Schema.Union<[typeof Schema.Boolean, typeof Schema.String, Schema.Array$<typeof Schema.Unknown>]>>;
1922
+ fixed: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
1923
+ linked: Schema.optional<Schema.Array$<Schema.Array$<typeof Schema.String>>>;
1924
+ access: Schema.optional<Schema.Literal<["public", "restricted"]>>;
1925
+ baseBranch: Schema.optional<typeof Schema.String>;
1926
+ updateInternalDependencies: Schema.optional<Schema.Literal<["patch", "minor", "major"]>>;
1927
+ ignore: Schema.optional<Schema.Array$<typeof Schema.String>>;
1928
+ privatePackages: Schema.optional<Schema.Union<[Schema.Struct<{
1929
+ tag: Schema.optional<typeof Schema.Boolean>;
1930
+ version: Schema.optional<typeof Schema.Boolean>;
1931
+ }>, Schema.Literal<[false]>]>>;
1932
+ prettier: Schema.optional<typeof Schema.Boolean>;
1933
+ changedFilePatterns: Schema.optional<Schema.Array$<typeof Schema.String>>;
1934
+ bumpVersionsWithWorkspaceProtocolOnly: Schema.optional<typeof Schema.Boolean>;
1935
+ snapshot: Schema.optional<Schema.Struct<{
1936
+ useCalculatedVersion: Schema.optional<typeof Schema.Boolean>;
1937
+ prereleaseTemplate: Schema.optional<typeof Schema.String>;
1938
+ }>>;
1939
+ }>]>>;
1940
+ versioning: Schema.NullOr<Schema.Struct<{
1941
+ type: Schema.Literal<["single", "fixed-group", "independent"]>;
1942
+ fixedGroups: Schema.Array$<Schema.Array$<typeof Schema.String>>;
1943
+ publishablePackages: Schema.Array$<typeof Schema.String>;
1944
+ }>>;
1945
+ tagStrategy: Schema.NullOr<Schema.Literal<["single", "scoped"]>>;
1946
+ }>;
1947
+
1948
+ /**
1949
+ * Raised when workspace analysis fails for a given root directory.
1950
+ *
1951
+ * @remarks
1952
+ * Returned by {@link SilkWorkspaceAnalyzer.analyze} when the analysis pipeline
1953
+ * encounters an unrecoverable error — e.g. workspace discovery failure,
1954
+ * package manager detection failure, or publishability detection errors.
1955
+ *
1956
+ * @since 0.2.0
1957
+ */
1958
+ export declare class WorkspaceAnalysisError extends WorkspaceAnalysisError_base<{
1959
+ readonly root: string;
1960
+ readonly reason: string;
1961
+ }> {
1962
+ get message(): string;
1963
+ }
1964
+
1965
+ declare const WorkspaceAnalysisError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
1966
+ readonly _tag: "WorkspaceAnalysisError";
1967
+ } & Readonly<A>;
1968
+
1785
1969
  export { }