@savvy-web/silk-effects 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -17
- package/index.d.ts +902 -162
- package/index.js +1020 -6
- package/package.json +3 -39
- package/biome.d.ts +0 -135
- package/biome.js +0 -84
- package/config.d.ts +0 -147
- package/config.js +0 -38
- package/hooks.d.ts +0 -197
- package/hooks.js +0 -96
- package/publish.d.ts +0 -260
- package/publish.js +0 -124
- package/tags.d.ts +0 -122
- package/tags.js +0 -25
- package/versioning.d.ts +0 -234
- package/versioning.js +0 -115
package/index.d.ts
CHANGED
|
@@ -9,12 +9,22 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { Command } from '@effect/platform';
|
|
13
|
+
import { CommandExecutor } from '@effect/platform';
|
|
12
14
|
import { Context } from 'effect';
|
|
15
|
+
import { Data } from 'effect';
|
|
13
16
|
import { Effect } from 'effect';
|
|
17
|
+
import { Equal } from 'effect';
|
|
14
18
|
import { FileSystem } from '@effect/platform';
|
|
19
|
+
import { Hash } from 'effect';
|
|
15
20
|
import { Layer } from 'effect';
|
|
21
|
+
import { PackageManagerDetector } from 'workspaces-effect';
|
|
22
|
+
import type { PlatformError } from '@effect/platform/Error';
|
|
16
23
|
import { Schema } from 'effect';
|
|
24
|
+
import type { Stream } from 'effect';
|
|
25
|
+
import { Unify } from 'effect/Unify';
|
|
17
26
|
import { VoidIfEmpty } from 'effect/Types';
|
|
27
|
+
import { WorkspaceRoot } from 'workspaces-effect';
|
|
18
28
|
import { YieldableError } from 'effect/Cause';
|
|
19
29
|
|
|
20
30
|
/**
|
|
@@ -157,6 +167,16 @@ export declare const BiomeSyncResult: Schema.Struct<{
|
|
|
157
167
|
/** @since 0.1.0 */
|
|
158
168
|
export declare type BiomeSyncResult = typeof BiomeSyncResult.Type;
|
|
159
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Build the expected Biome JSON schema URL for a given version.
|
|
172
|
+
*
|
|
173
|
+
* @param version - Bare semver string (e.g. `"1.9.3"`).
|
|
174
|
+
* @returns The canonical `biomejs.dev` schema URL for that version.
|
|
175
|
+
*
|
|
176
|
+
* @since 0.1.0
|
|
177
|
+
*/
|
|
178
|
+
export declare function buildSchemaUrl(version: string): string;
|
|
179
|
+
|
|
160
180
|
/**
|
|
161
181
|
* Standard changesets configuration matching the `@changesets/types` upstream spec.
|
|
162
182
|
*
|
|
@@ -250,6 +270,77 @@ declare const ChangesetConfigReader_base: Context.TagClass<ChangesetConfigReader
|
|
|
250
270
|
*/
|
|
251
271
|
export declare const ChangesetConfigReaderLive: Layer.Layer<ChangesetConfigReader, never, FileSystem.FileSystem>;
|
|
252
272
|
|
|
273
|
+
/** @since 0.2.0 */
|
|
274
|
+
export declare type CheckResult = Data.TaggedEnum<CheckResultDefinition>;
|
|
275
|
+
|
|
276
|
+
/** @since 0.2.0 */
|
|
277
|
+
export declare const CheckResult: {
|
|
278
|
+
readonly $is: <Tag extends "Found" | "NotFound">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
279
|
+
readonly _tag: "Found";
|
|
280
|
+
readonly isUpToDate: boolean;
|
|
281
|
+
readonly diff: SectionDiff;
|
|
282
|
+
}, {
|
|
283
|
+
readonly _tag: Tag;
|
|
284
|
+
}> | Extract<{
|
|
285
|
+
readonly _tag: "NotFound";
|
|
286
|
+
}, {
|
|
287
|
+
readonly _tag: Tag;
|
|
288
|
+
}>;
|
|
289
|
+
readonly $match: {
|
|
290
|
+
<const Cases extends { readonly [Tag in "Found" | "NotFound"]: (args: Extract<{
|
|
291
|
+
readonly _tag: "Found";
|
|
292
|
+
readonly isUpToDate: boolean;
|
|
293
|
+
readonly diff: SectionDiff;
|
|
294
|
+
} | {
|
|
295
|
+
readonly _tag: "NotFound";
|
|
296
|
+
}, {
|
|
297
|
+
readonly _tag: Tag;
|
|
298
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "Found" | "NotFound">]: never; }): (value: {
|
|
299
|
+
readonly _tag: "Found";
|
|
300
|
+
readonly isUpToDate: boolean;
|
|
301
|
+
readonly diff: SectionDiff;
|
|
302
|
+
} | {
|
|
303
|
+
readonly _tag: "NotFound";
|
|
304
|
+
}) => Unify<ReturnType<Cases["Found" | "NotFound"]>>;
|
|
305
|
+
<const Cases extends { readonly [Tag in "Found" | "NotFound"]: (args: Extract<{
|
|
306
|
+
readonly _tag: "Found";
|
|
307
|
+
readonly isUpToDate: boolean;
|
|
308
|
+
readonly diff: SectionDiff;
|
|
309
|
+
} | {
|
|
310
|
+
readonly _tag: "NotFound";
|
|
311
|
+
}, {
|
|
312
|
+
readonly _tag: Tag;
|
|
313
|
+
}>) => any; }>(value: {
|
|
314
|
+
readonly _tag: "Found";
|
|
315
|
+
readonly isUpToDate: boolean;
|
|
316
|
+
readonly diff: SectionDiff;
|
|
317
|
+
} | {
|
|
318
|
+
readonly _tag: "NotFound";
|
|
319
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Found" | "NotFound">]: never; }): Unify<ReturnType<Cases["Found" | "NotFound"]>>;
|
|
320
|
+
};
|
|
321
|
+
readonly Found: Data.Case.Constructor<{
|
|
322
|
+
readonly _tag: "Found";
|
|
323
|
+
readonly isUpToDate: boolean;
|
|
324
|
+
readonly diff: SectionDiff;
|
|
325
|
+
}, "_tag">;
|
|
326
|
+
readonly NotFound: Data.Case.Constructor<{
|
|
327
|
+
readonly _tag: "NotFound";
|
|
328
|
+
}, "_tag">;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Result of a check operation.
|
|
333
|
+
*
|
|
334
|
+
* @since 0.2.0
|
|
335
|
+
*/
|
|
336
|
+
export declare type CheckResultDefinition = {
|
|
337
|
+
readonly Found: {
|
|
338
|
+
readonly isUpToDate: boolean;
|
|
339
|
+
readonly diff: SectionDiff;
|
|
340
|
+
};
|
|
341
|
+
readonly NotFound: {};
|
|
342
|
+
};
|
|
343
|
+
|
|
253
344
|
/**
|
|
254
345
|
* Comment syntax used to write managed section markers.
|
|
255
346
|
*
|
|
@@ -403,178 +494,56 @@ export declare const ConfigSource: Schema.Literal<["lib", "root", "cosmiconfig"]
|
|
|
403
494
|
export declare type ConfigSource = typeof ConfigSource.Type;
|
|
404
495
|
|
|
405
496
|
/**
|
|
406
|
-
*
|
|
407
|
-
* within user-editable files (e.g. husky hooks).
|
|
408
|
-
*
|
|
409
|
-
* @remarks
|
|
410
|
-
* A managed section is a delimited block in a file bounded by BEGIN/END marker comments.
|
|
411
|
-
* The markers embed the tool name so multiple tools can manage independent sections in
|
|
412
|
-
* the same file. User content outside the markers is always preserved.
|
|
413
|
-
*
|
|
414
|
-
* @example
|
|
415
|
-
* ```typescript
|
|
416
|
-
* const result = await Effect.runPromise(
|
|
417
|
-
* Effect.gen(function* () {
|
|
418
|
-
* const section = yield* ManagedSection;
|
|
419
|
-
* yield* section.write(".husky/pre-commit", "silk", "\nnpx lint-staged\n");
|
|
420
|
-
* return yield* section.read(".husky/pre-commit", "silk");
|
|
421
|
-
* }).pipe(
|
|
422
|
-
* Effect.provide(ManagedSectionLive),
|
|
423
|
-
* Effect.provide(NodeContext.layer),
|
|
424
|
-
* )
|
|
425
|
-
* );
|
|
426
|
-
* ```
|
|
497
|
+
* Strip leading semver range operators from a version string.
|
|
427
498
|
*
|
|
428
|
-
* @
|
|
429
|
-
|
|
430
|
-
export declare class ManagedSection extends ManagedSection_base {
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
declare const ManagedSection_base: Context.TagClass<ManagedSection, "@savvy-web/silk-effects/ManagedSection", {
|
|
434
|
-
/**
|
|
435
|
-
* Read and parse the managed section from a file.
|
|
436
|
-
*
|
|
437
|
-
* @param path - Absolute path to the file.
|
|
438
|
-
* @param toolName - Tool identifier embedded in the section markers.
|
|
439
|
-
* @param commentStyle - Comment prefix to use (`"#"` or `"//"`, defaults to `"#"`).
|
|
440
|
-
* @returns An `Effect` that succeeds with a {@link ManagedSectionResult} when markers
|
|
441
|
-
* are found, `null` when the file has no markers, or fails with
|
|
442
|
-
* {@link ManagedSectionParseError} on I/O errors.
|
|
443
|
-
*
|
|
444
|
-
* @since 0.1.0
|
|
445
|
-
*/
|
|
446
|
-
readonly read: (path: string, toolName: string, commentStyle?: string) => Effect.Effect<ManagedSectionResult | null, ManagedSectionParseError>;
|
|
447
|
-
/**
|
|
448
|
-
* Write managed content to a file.
|
|
449
|
-
*
|
|
450
|
-
* @remarks
|
|
451
|
-
* - Replaces the existing managed section when markers are already present.
|
|
452
|
-
* - Appends a new managed section when the file exists but has no markers.
|
|
453
|
-
* - Creates the file when it does not exist.
|
|
454
|
-
*
|
|
455
|
-
* @param path - Absolute path to the file.
|
|
456
|
-
* @param toolName - Tool identifier embedded in the section markers.
|
|
457
|
-
* @param content - Content to place inside the managed section (between markers).
|
|
458
|
-
* @param commentStyle - Comment prefix to use (`"#"` or `"//"`, defaults to `"#"`).
|
|
459
|
-
* @returns An `Effect` that succeeds with `void` or fails with {@link ManagedSectionWriteError}.
|
|
460
|
-
*
|
|
461
|
-
* @since 0.1.0
|
|
462
|
-
*/
|
|
463
|
-
readonly write: (path: string, toolName: string, content: string, commentStyle?: string) => Effect.Effect<void, ManagedSectionWriteError>;
|
|
464
|
-
/**
|
|
465
|
-
* Read-then-write convenience method that replaces managed content while
|
|
466
|
-
* preserving surrounding user content.
|
|
467
|
-
*
|
|
468
|
-
* @param path - Absolute path to the file.
|
|
469
|
-
* @param toolName - Tool identifier embedded in the section markers.
|
|
470
|
-
* @param content - Replacement content for the managed section.
|
|
471
|
-
* @param commentStyle - Comment prefix to use (`"#"` or `"//"`, defaults to `"#"`).
|
|
472
|
-
* @returns An `Effect` that succeeds with `void` or fails with {@link ManagedSectionWriteError}.
|
|
473
|
-
*
|
|
474
|
-
* @since 0.1.0
|
|
475
|
-
*/
|
|
476
|
-
readonly update: (path: string, toolName: string, content: string, commentStyle?: string) => Effect.Effect<void, ManagedSectionWriteError>;
|
|
477
|
-
/**
|
|
478
|
-
* Return `true` when the file contains both BEGIN and END markers for the given tool.
|
|
479
|
-
*
|
|
480
|
-
* @param path - Absolute path to the file.
|
|
481
|
-
* @param toolName - Tool identifier to search for in the markers.
|
|
482
|
-
* @param commentStyle - Comment prefix to match (`"#"` or `"//"`, defaults to `"#"`).
|
|
483
|
-
* @returns An `Effect` that always succeeds with a boolean.
|
|
484
|
-
*
|
|
485
|
-
* @since 0.1.0
|
|
486
|
-
*/
|
|
487
|
-
readonly isManaged: (path: string, toolName: string, commentStyle?: string) => Effect.Effect<boolean>;
|
|
488
|
-
}>;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Live implementation of {@link ManagedSection} backed by `@effect/platform` FileSystem.
|
|
492
|
-
*
|
|
493
|
-
* @remarks
|
|
494
|
-
* Requires `FileSystem` from `@effect/platform`. Provide `NodeContext.layer` or
|
|
495
|
-
* `BunContext.layer` to satisfy this dependency.
|
|
496
|
-
*
|
|
497
|
-
* @since 0.1.0
|
|
498
|
-
*/
|
|
499
|
-
export declare const ManagedSectionLive: Layer.Layer<ManagedSection, never, FileSystem.FileSystem>;
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Options controlling how managed sections are identified in a file.
|
|
503
|
-
*
|
|
504
|
-
* @remarks
|
|
505
|
-
* `toolName` is embedded in the BEGIN/END markers so multiple tools can coexist
|
|
506
|
-
* in the same file without collision. `commentStyle` defaults to `"#"`.
|
|
499
|
+
* @param version - Raw version string that may include `^`, `~`, `>=`, `<`, `=`, or `v` prefixes.
|
|
500
|
+
* @returns The bare semver string (e.g. `"1.9.3"`).
|
|
507
501
|
*
|
|
508
502
|
* @since 0.1.0
|
|
509
503
|
*/
|
|
510
|
-
export declare
|
|
511
|
-
toolName: typeof Schema.String;
|
|
512
|
-
commentStyle: Schema.optionalWith<Schema.Literal<["#", "//"]>, {
|
|
513
|
-
default: () => "#";
|
|
514
|
-
}>;
|
|
515
|
-
}>;
|
|
516
|
-
|
|
517
|
-
/** @since 0.1.0 */
|
|
518
|
-
export declare type ManagedSectionOptions = typeof ManagedSectionOptions.Type;
|
|
504
|
+
export declare function extractSemver(version: string): string;
|
|
519
505
|
|
|
520
506
|
/**
|
|
521
|
-
*
|
|
507
|
+
* Service for managing delimited sections in user-editable files.
|
|
522
508
|
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
509
|
+
* All methods use dual API (data-first and data-last).
|
|
510
|
+
* Identity-only operations (`read`, `isManaged`) take a {@link SectionDefinition}.
|
|
511
|
+
* Content operations (`write`, `sync`, `check`) take a {@link SectionBlock}.
|
|
526
512
|
*
|
|
527
|
-
* @since 0.
|
|
513
|
+
* @since 0.2.0
|
|
528
514
|
*/
|
|
529
|
-
export declare class
|
|
530
|
-
readonly path: string;
|
|
531
|
-
readonly reason: string;
|
|
532
|
-
}> {
|
|
533
|
-
get message(): string;
|
|
515
|
+
export declare class ManagedSection extends ManagedSection_base {
|
|
534
516
|
}
|
|
535
517
|
|
|
536
|
-
declare const
|
|
537
|
-
readonly
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
518
|
+
declare const ManagedSection_base: Context.TagClass<ManagedSection, "@savvy-web/silk-effects/ManagedSection", {
|
|
519
|
+
readonly read: {
|
|
520
|
+
(definition: SectionDefinition): (path: string) => Effect.Effect<SectionBlock | null, SectionParseError>;
|
|
521
|
+
(path: string, definition: SectionDefinition): Effect.Effect<SectionBlock | null, SectionParseError>;
|
|
522
|
+
};
|
|
523
|
+
readonly isManaged: {
|
|
524
|
+
(definition: SectionDefinition): (path: string) => Effect.Effect<boolean>;
|
|
525
|
+
(path: string, definition: SectionDefinition): Effect.Effect<boolean>;
|
|
526
|
+
};
|
|
527
|
+
readonly write: {
|
|
528
|
+
(block: SectionBlock): (path: string) => Effect.Effect<void, SectionWriteError>;
|
|
529
|
+
(path: string, block: SectionBlock): Effect.Effect<void, SectionWriteError>;
|
|
530
|
+
};
|
|
531
|
+
readonly sync: {
|
|
532
|
+
(block: SectionBlock): (path: string) => Effect.Effect<SyncResult, SectionWriteError>;
|
|
533
|
+
(path: string, block: SectionBlock): Effect.Effect<SyncResult, SectionWriteError>;
|
|
534
|
+
};
|
|
535
|
+
readonly check: {
|
|
536
|
+
(block: SectionBlock): (path: string) => Effect.Effect<CheckResult, SectionParseError>;
|
|
537
|
+
(path: string, block: SectionBlock): Effect.Effect<CheckResult, SectionParseError>;
|
|
538
|
+
};
|
|
554
539
|
}>;
|
|
555
540
|
|
|
556
|
-
/** @since 0.1.0 */
|
|
557
|
-
export declare type ManagedSectionResult = typeof ManagedSectionResult.Type;
|
|
558
|
-
|
|
559
541
|
/**
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
* @remarks
|
|
563
|
-
* Returned by {@link ManagedSection.write} and {@link ManagedSection.update} when
|
|
564
|
-
* the file cannot be read for content replacement or when the write itself fails.
|
|
542
|
+
* Live implementation of {@link ManagedSection} backed by `@effect/platform` FileSystem.
|
|
565
543
|
*
|
|
566
|
-
* @since 0.
|
|
544
|
+
* @since 0.2.0
|
|
567
545
|
*/
|
|
568
|
-
export declare
|
|
569
|
-
readonly path: string;
|
|
570
|
-
readonly reason: string;
|
|
571
|
-
}> {
|
|
572
|
-
get message(): string;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
declare const ManagedSectionWriteError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
576
|
-
readonly _tag: "ManagedSectionWriteError";
|
|
577
|
-
} & Readonly<A>;
|
|
546
|
+
export declare const ManagedSectionLive: Layer.Layer<ManagedSection, never, FileSystem.FileSystem>;
|
|
578
547
|
|
|
579
548
|
/**
|
|
580
549
|
* Raised when the `publishConfig` field in a `package.json` is present but invalid.
|
|
@@ -620,7 +589,7 @@ export declare type PublishProtocol = typeof PublishProtocol.Type;
|
|
|
620
589
|
*
|
|
621
590
|
* @since 0.1.0
|
|
622
591
|
*/
|
|
623
|
-
|
|
592
|
+
declare const PublishTarget: Schema.Union<[Schema.Literal<["npm", "github", "jsr"]>, Schema.filter<typeof Schema.String>, Schema.Struct<{
|
|
624
593
|
protocol: Schema.optionalWith<Schema.Literal<["npm", "jsr"]>, {
|
|
625
594
|
default: () => "npm";
|
|
626
595
|
}>;
|
|
@@ -632,7 +601,9 @@ export declare const PublishTarget: Schema.Union<[Schema.Literal<["npm", "github
|
|
|
632
601
|
}>]>;
|
|
633
602
|
|
|
634
603
|
/** @since 0.1.0 */
|
|
635
|
-
|
|
604
|
+
declare type PublishTarget = typeof PublishTarget.Type;
|
|
605
|
+
export { PublishTarget }
|
|
606
|
+
export { PublishTarget as PublishTargetSchema }
|
|
636
607
|
|
|
637
608
|
/**
|
|
638
609
|
* Full publish-target configuration expressed as a structured object.
|
|
@@ -667,10 +638,96 @@ export declare type PublishTargetObject = typeof PublishTargetObject.Type;
|
|
|
667
638
|
*
|
|
668
639
|
* @since 0.1.0
|
|
669
640
|
*/
|
|
670
|
-
|
|
641
|
+
declare const PublishTargetShorthand: Schema.Literal<["npm", "github", "jsr"]>;
|
|
671
642
|
|
|
672
643
|
/** @since 0.1.0 */
|
|
673
|
-
|
|
644
|
+
declare type PublishTargetShorthand = typeof PublishTargetShorthand.Type;
|
|
645
|
+
export { PublishTargetShorthand }
|
|
646
|
+
export { PublishTargetShorthand as PublishTargetShorthandSchema }
|
|
647
|
+
|
|
648
|
+
/** @since 0.2.0 */
|
|
649
|
+
export declare type ResolutionPolicy = Data.TaggedEnum<ResolutionPolicyDefinition>;
|
|
650
|
+
|
|
651
|
+
/** @since 0.2.0 */
|
|
652
|
+
export declare const ResolutionPolicy: {
|
|
653
|
+
readonly $is: <Tag extends "PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
654
|
+
readonly _tag: "PreferGlobal";
|
|
655
|
+
}, {
|
|
656
|
+
readonly _tag: Tag;
|
|
657
|
+
}> | Extract<{
|
|
658
|
+
readonly _tag: "PreferLocal";
|
|
659
|
+
}, {
|
|
660
|
+
readonly _tag: Tag;
|
|
661
|
+
}> | Extract<{
|
|
662
|
+
readonly _tag: "Report";
|
|
663
|
+
}, {
|
|
664
|
+
readonly _tag: Tag;
|
|
665
|
+
}> | Extract<{
|
|
666
|
+
readonly _tag: "RequireMatch";
|
|
667
|
+
}, {
|
|
668
|
+
readonly _tag: Tag;
|
|
669
|
+
}>;
|
|
670
|
+
readonly $match: {
|
|
671
|
+
<const Cases extends { readonly [Tag in "PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch"]: (args: Extract<{
|
|
672
|
+
readonly _tag: "PreferGlobal";
|
|
673
|
+
} | {
|
|
674
|
+
readonly _tag: "PreferLocal";
|
|
675
|
+
} | {
|
|
676
|
+
readonly _tag: "Report";
|
|
677
|
+
} | {
|
|
678
|
+
readonly _tag: "RequireMatch";
|
|
679
|
+
}, {
|
|
680
|
+
readonly _tag: Tag;
|
|
681
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch">]: never; }): (value: {
|
|
682
|
+
readonly _tag: "PreferGlobal";
|
|
683
|
+
} | {
|
|
684
|
+
readonly _tag: "PreferLocal";
|
|
685
|
+
} | {
|
|
686
|
+
readonly _tag: "Report";
|
|
687
|
+
} | {
|
|
688
|
+
readonly _tag: "RequireMatch";
|
|
689
|
+
}) => Unify<ReturnType<Cases["PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch"]>>;
|
|
690
|
+
<const Cases extends { readonly [Tag in "PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch"]: (args: Extract<{
|
|
691
|
+
readonly _tag: "PreferGlobal";
|
|
692
|
+
} | {
|
|
693
|
+
readonly _tag: "PreferLocal";
|
|
694
|
+
} | {
|
|
695
|
+
readonly _tag: "Report";
|
|
696
|
+
} | {
|
|
697
|
+
readonly _tag: "RequireMatch";
|
|
698
|
+
}, {
|
|
699
|
+
readonly _tag: Tag;
|
|
700
|
+
}>) => any; }>(value: {
|
|
701
|
+
readonly _tag: "PreferGlobal";
|
|
702
|
+
} | {
|
|
703
|
+
readonly _tag: "PreferLocal";
|
|
704
|
+
} | {
|
|
705
|
+
readonly _tag: "Report";
|
|
706
|
+
} | {
|
|
707
|
+
readonly _tag: "RequireMatch";
|
|
708
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch">]: never; }): Unify<ReturnType<Cases["PreferGlobal" | "PreferLocal" | "Report" | "RequireMatch"]>>;
|
|
709
|
+
};
|
|
710
|
+
readonly PreferGlobal: Data.Case.Constructor<{
|
|
711
|
+
readonly _tag: "PreferGlobal";
|
|
712
|
+
}, "_tag">;
|
|
713
|
+
readonly PreferLocal: Data.Case.Constructor<{
|
|
714
|
+
readonly _tag: "PreferLocal";
|
|
715
|
+
}, "_tag">;
|
|
716
|
+
readonly Report: Data.Case.Constructor<{
|
|
717
|
+
readonly _tag: "Report";
|
|
718
|
+
}, "_tag">;
|
|
719
|
+
readonly RequireMatch: Data.Case.Constructor<{
|
|
720
|
+
readonly _tag: "RequireMatch";
|
|
721
|
+
}, "_tag">;
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
/** What to do when both global and local versions differ. @since 0.2.0 */
|
|
725
|
+
export declare type ResolutionPolicyDefinition = {
|
|
726
|
+
readonly Report: {};
|
|
727
|
+
readonly PreferLocal: {};
|
|
728
|
+
readonly PreferGlobal: {};
|
|
729
|
+
readonly RequireMatch: {};
|
|
730
|
+
};
|
|
674
731
|
|
|
675
732
|
/**
|
|
676
733
|
* Fully resolved publish target with all fields populated and defaults applied.
|
|
@@ -682,7 +739,7 @@ export declare type PublishTargetShorthand = typeof PublishTargetShorthand.Type;
|
|
|
682
739
|
*
|
|
683
740
|
* @since 0.1.0
|
|
684
741
|
*/
|
|
685
|
-
|
|
742
|
+
declare const ResolvedTarget: Schema.Struct<{
|
|
686
743
|
protocol: Schema.Literal<["npm", "jsr"]>;
|
|
687
744
|
registry: Schema.NullOr<typeof Schema.String>;
|
|
688
745
|
directory: typeof Schema.String;
|
|
@@ -694,7 +751,268 @@ export declare const ResolvedTarget: Schema.Struct<{
|
|
|
694
751
|
}>;
|
|
695
752
|
|
|
696
753
|
/** @since 0.1.0 */
|
|
697
|
-
|
|
754
|
+
declare type ResolvedTarget = typeof ResolvedTarget.Type;
|
|
755
|
+
export { ResolvedTarget }
|
|
756
|
+
export { ResolvedTarget as ResolvedTargetSchema }
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Result of resolving a {@link ToolDefinition}.
|
|
760
|
+
*
|
|
761
|
+
* Provides {@link exec} and {@link dlx} to build commands for the resolved tool.
|
|
762
|
+
*
|
|
763
|
+
* @since 0.2.0
|
|
764
|
+
*/
|
|
765
|
+
export declare class ResolvedTool extends ResolvedTool_base {
|
|
766
|
+
get isGlobal(): boolean;
|
|
767
|
+
get isLocal(): boolean;
|
|
768
|
+
get hasVersionMismatch(): boolean;
|
|
769
|
+
exec(...args: string[]): ToolCommand;
|
|
770
|
+
dlx(...args: string[]): ToolCommand;
|
|
771
|
+
[Equal.symbol](that: Equal.Equal): boolean;
|
|
772
|
+
[Hash.symbol](): number;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
declare const ResolvedTool_base: Schema.TaggedClass<ResolvedTool, "ResolvedTool", {
|
|
776
|
+
readonly _tag: Schema.tag<"ResolvedTool">;
|
|
777
|
+
} & {
|
|
778
|
+
name: typeof Schema.String;
|
|
779
|
+
source: Schema.Literal<["global", "local"]>;
|
|
780
|
+
version: Schema.OptionFromSelf<typeof Schema.String>;
|
|
781
|
+
globalVersion: Schema.OptionFromSelf<typeof Schema.String>;
|
|
782
|
+
localVersion: Schema.OptionFromSelf<typeof Schema.String>;
|
|
783
|
+
packageManager: Schema.Literal<["npm", "pnpm", "yarn", "bun"]>;
|
|
784
|
+
mismatch: typeof Schema.Boolean;
|
|
785
|
+
}>;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* The content between managed section markers.
|
|
789
|
+
*
|
|
790
|
+
* {@link Equal} compares normalized content only (trimmed, whitespace-collapsed).
|
|
791
|
+
* Use {@link SectionBlock.diff | diff} to compute line-level differences.
|
|
792
|
+
*
|
|
793
|
+
* @since 0.2.0
|
|
794
|
+
*/
|
|
795
|
+
export declare class SectionBlock extends SectionBlock_base {
|
|
796
|
+
static diff: {
|
|
797
|
+
(that: SectionBlock): (self: SectionBlock) => SectionDiff;
|
|
798
|
+
(self: SectionBlock, that: SectionBlock): SectionDiff;
|
|
799
|
+
};
|
|
800
|
+
static prepend: {
|
|
801
|
+
(lines: string): (self: SectionBlock) => SectionBlock;
|
|
802
|
+
(self: SectionBlock, lines: string): SectionBlock;
|
|
803
|
+
};
|
|
804
|
+
static append: {
|
|
805
|
+
(lines: string): (self: SectionBlock) => SectionBlock;
|
|
806
|
+
(self: SectionBlock, lines: string): SectionBlock;
|
|
807
|
+
};
|
|
808
|
+
get text(): string;
|
|
809
|
+
get normalized(): string;
|
|
810
|
+
get rendered(): string;
|
|
811
|
+
prepend(lines: string): SectionBlock;
|
|
812
|
+
append(lines: string): SectionBlock;
|
|
813
|
+
diff(that: SectionBlock): SectionDiff;
|
|
814
|
+
[Equal.symbol](that: Equal.Equal): boolean;
|
|
815
|
+
[Hash.symbol](): number;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
declare const SectionBlock_base: Schema.TaggedClass<SectionBlock, "SectionBlock", {
|
|
819
|
+
readonly _tag: Schema.tag<"SectionBlock">;
|
|
820
|
+
} & {
|
|
821
|
+
toolName: typeof Schema.String;
|
|
822
|
+
commentStyle: Schema.Literal<["#", "//"]>;
|
|
823
|
+
content: typeof Schema.String;
|
|
824
|
+
}>;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Identity envelope for a managed section type.
|
|
828
|
+
*
|
|
829
|
+
* {@link Equal} compares on `toolName` + `commentStyle`.
|
|
830
|
+
* Use {@link SectionDefinition.block | block()} to create a {@link SectionBlock},
|
|
831
|
+
* or {@link SectionDefinition.generate | generate()} for a typed factory.
|
|
832
|
+
*
|
|
833
|
+
* @since 0.2.0
|
|
834
|
+
*/
|
|
835
|
+
export declare class SectionDefinition extends SectionDefinition_base {
|
|
836
|
+
private _validate?;
|
|
837
|
+
static generate: {
|
|
838
|
+
<C>(fn: (config: C) => string): (self: SectionDefinition) => (config: C) => SectionBlock;
|
|
839
|
+
<C>(self: SectionDefinition, fn: (config: C) => string): (config: C) => SectionBlock;
|
|
840
|
+
};
|
|
841
|
+
static generateEffect: {
|
|
842
|
+
<C, E, R>(fn: (config: C) => Effect.Effect<string, E, R>): (self: SectionDefinition) => (config: C) => Effect.Effect<SectionBlock, E | SectionValidationError, R>;
|
|
843
|
+
<C, E, R>(self: SectionDefinition, fn: (config: C) => Effect.Effect<string, E, R>): (config: C) => Effect.Effect<SectionBlock, E | SectionValidationError, R>;
|
|
844
|
+
};
|
|
845
|
+
static withValidation: {
|
|
846
|
+
(fn: (block: SectionBlock) => boolean): (self: SectionDefinition) => SectionDefinition;
|
|
847
|
+
(self: SectionDefinition, fn: (block: SectionBlock) => boolean): SectionDefinition;
|
|
848
|
+
};
|
|
849
|
+
static diff: {
|
|
850
|
+
(that: SectionDefinition): (self: SectionDefinition) => SectionDiff;
|
|
851
|
+
(self: SectionDefinition, that: SectionDefinition): SectionDiff;
|
|
852
|
+
};
|
|
853
|
+
block(content: string): SectionBlock;
|
|
854
|
+
generate<C>(fn: (config: C) => string): (config: C) => SectionBlock;
|
|
855
|
+
generateEffect<C, E, R>(fn: (config: C) => Effect.Effect<string, E, R>): (config: C) => Effect.Effect<SectionBlock, E | SectionValidationError, R>;
|
|
856
|
+
diff(that: SectionDefinition): SectionDiff;
|
|
857
|
+
get beginMarker(): string;
|
|
858
|
+
get endMarker(): string;
|
|
859
|
+
[Equal.symbol](that: Equal.Equal): boolean;
|
|
860
|
+
[Hash.symbol](): number;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
declare const SectionDefinition_base: Schema.TaggedClass<SectionDefinition, "SectionDefinition", {
|
|
864
|
+
readonly _tag: Schema.tag<"SectionDefinition">;
|
|
865
|
+
} & {
|
|
866
|
+
toolName: typeof Schema.String;
|
|
867
|
+
commentStyle: Schema.optionalWith<Schema.Literal<["#", "//"]>, {
|
|
868
|
+
default: () => "#";
|
|
869
|
+
}>;
|
|
870
|
+
}>;
|
|
871
|
+
|
|
872
|
+
/** @since 0.2.0 */
|
|
873
|
+
export declare type SectionDiff = Data.TaggedEnum<SectionDiffDefinition>;
|
|
874
|
+
|
|
875
|
+
/** @since 0.2.0 */
|
|
876
|
+
export declare const SectionDiff: {
|
|
877
|
+
readonly $is: <Tag extends "Changed" | "Unchanged">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
878
|
+
readonly _tag: "Changed";
|
|
879
|
+
readonly added: ReadonlyArray<string>;
|
|
880
|
+
readonly removed: ReadonlyArray<string>;
|
|
881
|
+
}, {
|
|
882
|
+
readonly _tag: Tag;
|
|
883
|
+
}> | Extract<{
|
|
884
|
+
readonly _tag: "Unchanged";
|
|
885
|
+
}, {
|
|
886
|
+
readonly _tag: Tag;
|
|
887
|
+
}>;
|
|
888
|
+
readonly $match: {
|
|
889
|
+
<const Cases extends { readonly [Tag in "Changed" | "Unchanged"]: (args: Extract<{
|
|
890
|
+
readonly _tag: "Changed";
|
|
891
|
+
readonly added: ReadonlyArray<string>;
|
|
892
|
+
readonly removed: ReadonlyArray<string>;
|
|
893
|
+
}, {
|
|
894
|
+
readonly _tag: Tag;
|
|
895
|
+
}> | Extract<{
|
|
896
|
+
readonly _tag: "Unchanged";
|
|
897
|
+
}, {
|
|
898
|
+
readonly _tag: Tag;
|
|
899
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "Changed" | "Unchanged">]: never; }): (value: {
|
|
900
|
+
readonly _tag: "Changed";
|
|
901
|
+
readonly added: ReadonlyArray<string>;
|
|
902
|
+
readonly removed: ReadonlyArray<string>;
|
|
903
|
+
} | {
|
|
904
|
+
readonly _tag: "Unchanged";
|
|
905
|
+
}) => Unify<ReturnType<Cases["Changed" | "Unchanged"]>>;
|
|
906
|
+
<const Cases extends { readonly [Tag in "Changed" | "Unchanged"]: (args: Extract<{
|
|
907
|
+
readonly _tag: "Changed";
|
|
908
|
+
readonly added: ReadonlyArray<string>;
|
|
909
|
+
readonly removed: ReadonlyArray<string>;
|
|
910
|
+
}, {
|
|
911
|
+
readonly _tag: Tag;
|
|
912
|
+
}> | Extract<{
|
|
913
|
+
readonly _tag: "Unchanged";
|
|
914
|
+
}, {
|
|
915
|
+
readonly _tag: Tag;
|
|
916
|
+
}>) => any; }>(value: {
|
|
917
|
+
readonly _tag: "Changed";
|
|
918
|
+
readonly added: ReadonlyArray<string>;
|
|
919
|
+
readonly removed: ReadonlyArray<string>;
|
|
920
|
+
} | {
|
|
921
|
+
readonly _tag: "Unchanged";
|
|
922
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Changed" | "Unchanged">]: never; }): Unify<ReturnType<Cases["Changed" | "Unchanged"]>>;
|
|
923
|
+
};
|
|
924
|
+
readonly Changed: Data.Case.Constructor<{
|
|
925
|
+
readonly _tag: "Changed";
|
|
926
|
+
readonly added: ReadonlyArray<string>;
|
|
927
|
+
readonly removed: ReadonlyArray<string>;
|
|
928
|
+
}, "_tag">;
|
|
929
|
+
readonly Unchanged: Data.Case.Constructor<{
|
|
930
|
+
readonly _tag: "Unchanged";
|
|
931
|
+
}, "_tag">;
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Result of comparing two section contents.
|
|
936
|
+
*
|
|
937
|
+
* @since 0.2.0
|
|
938
|
+
*/
|
|
939
|
+
export declare type SectionDiffDefinition = {
|
|
940
|
+
readonly Unchanged: {};
|
|
941
|
+
readonly Changed: {
|
|
942
|
+
readonly added: ReadonlyArray<string>;
|
|
943
|
+
readonly removed: ReadonlyArray<string>;
|
|
944
|
+
};
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Raised when a managed section cannot be parsed from a file.
|
|
949
|
+
*
|
|
950
|
+
* @since 0.2.0
|
|
951
|
+
*/
|
|
952
|
+
export declare class SectionParseError extends SectionParseError_base<{
|
|
953
|
+
readonly path: string;
|
|
954
|
+
readonly reason: string;
|
|
955
|
+
}> {
|
|
956
|
+
get message(): string;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
declare const SectionParseError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
960
|
+
readonly _tag: "SectionParseError";
|
|
961
|
+
} & Readonly<A>;
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Raised when a {@link SectionBlock} fails validation at creation time.
|
|
965
|
+
*
|
|
966
|
+
* @since 0.2.0
|
|
967
|
+
*/
|
|
968
|
+
export declare class SectionValidationError extends SectionValidationError_base<{
|
|
969
|
+
readonly toolName: string;
|
|
970
|
+
readonly reason: string;
|
|
971
|
+
}> {
|
|
972
|
+
get message(): string;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
declare const SectionValidationError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
976
|
+
readonly _tag: "SectionValidationError";
|
|
977
|
+
} & Readonly<A>;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Raised when a managed section cannot be written to a file.
|
|
981
|
+
*
|
|
982
|
+
* @since 0.2.0
|
|
983
|
+
*/
|
|
984
|
+
export declare class SectionWriteError extends SectionWriteError_base<{
|
|
985
|
+
readonly path: string;
|
|
986
|
+
readonly reason: string;
|
|
987
|
+
}> {
|
|
988
|
+
get message(): string;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
declare const SectionWriteError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
992
|
+
readonly _tag: "SectionWriteError";
|
|
993
|
+
} & Readonly<A>;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* Convenience section definition for shell hooks.
|
|
997
|
+
*
|
|
998
|
+
* `commentStyle` is always `"#"` — only `toolName` is required.
|
|
999
|
+
*
|
|
1000
|
+
* @since 0.2.0
|
|
1001
|
+
*/
|
|
1002
|
+
export declare class ShellSectionDefinition extends ShellSectionDefinition_base {
|
|
1003
|
+
get commentStyle(): CommentStyle;
|
|
1004
|
+
block(content: string): SectionBlock;
|
|
1005
|
+
generate<C>(fn: (config: C) => string): (config: C) => SectionBlock;
|
|
1006
|
+
generateEffect<C, E, R>(fn: (config: C) => Effect.Effect<string, E, R>): (config: C) => Effect.Effect<SectionBlock, E, R>;
|
|
1007
|
+
get beginMarker(): string;
|
|
1008
|
+
get endMarker(): string;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
declare const ShellSectionDefinition_base: Schema.TaggedClass<ShellSectionDefinition, "ShellSectionDefinition", {
|
|
1012
|
+
readonly _tag: Schema.tag<"ShellSectionDefinition">;
|
|
1013
|
+
} & {
|
|
1014
|
+
toolName: typeof Schema.String;
|
|
1015
|
+
}>;
|
|
698
1016
|
|
|
699
1017
|
/**
|
|
700
1018
|
* Extended changeset config for repos using the `@savvy-web/changesets` changelog adapter.
|
|
@@ -776,6 +1094,170 @@ declare const SilkPublishabilityPlugin_base: Context.TagClass<SilkPublishability
|
|
|
776
1094
|
*/
|
|
777
1095
|
export declare const SilkPublishabilityPluginLive: Layer.Layer<SilkPublishabilityPlugin, never, TargetResolver>;
|
|
778
1096
|
|
|
1097
|
+
/** @since 0.2.0 */
|
|
1098
|
+
export declare type SourceRequirement = Data.TaggedEnum<SourceRequirementDefinition>;
|
|
1099
|
+
|
|
1100
|
+
/** @since 0.2.0 */
|
|
1101
|
+
export declare const SourceRequirement: {
|
|
1102
|
+
readonly $is: <Tag extends "Any" | "Both" | "OnlyGlobal" | "OnlyLocal">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
1103
|
+
readonly _tag: "Any";
|
|
1104
|
+
}, {
|
|
1105
|
+
readonly _tag: Tag;
|
|
1106
|
+
}> | Extract<{
|
|
1107
|
+
readonly _tag: "Both";
|
|
1108
|
+
}, {
|
|
1109
|
+
readonly _tag: Tag;
|
|
1110
|
+
}> | Extract<{
|
|
1111
|
+
readonly _tag: "OnlyGlobal";
|
|
1112
|
+
}, {
|
|
1113
|
+
readonly _tag: Tag;
|
|
1114
|
+
}> | Extract<{
|
|
1115
|
+
readonly _tag: "OnlyLocal";
|
|
1116
|
+
}, {
|
|
1117
|
+
readonly _tag: Tag;
|
|
1118
|
+
}>;
|
|
1119
|
+
readonly $match: {
|
|
1120
|
+
<const Cases extends { readonly [Tag in "Any" | "Both" | "OnlyGlobal" | "OnlyLocal"]: (args: Extract<{
|
|
1121
|
+
readonly _tag: "Any";
|
|
1122
|
+
} | {
|
|
1123
|
+
readonly _tag: "Both";
|
|
1124
|
+
} | {
|
|
1125
|
+
readonly _tag: "OnlyGlobal";
|
|
1126
|
+
} | {
|
|
1127
|
+
readonly _tag: "OnlyLocal";
|
|
1128
|
+
}, {
|
|
1129
|
+
readonly _tag: Tag;
|
|
1130
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "Any" | "Both" | "OnlyGlobal" | "OnlyLocal">]: never; }): (value: {
|
|
1131
|
+
readonly _tag: "Any";
|
|
1132
|
+
} | {
|
|
1133
|
+
readonly _tag: "Both";
|
|
1134
|
+
} | {
|
|
1135
|
+
readonly _tag: "OnlyGlobal";
|
|
1136
|
+
} | {
|
|
1137
|
+
readonly _tag: "OnlyLocal";
|
|
1138
|
+
}) => Unify<ReturnType<Cases["Any" | "Both" | "OnlyGlobal" | "OnlyLocal"]>>;
|
|
1139
|
+
<const Cases extends { readonly [Tag in "Any" | "Both" | "OnlyGlobal" | "OnlyLocal"]: (args: Extract<{
|
|
1140
|
+
readonly _tag: "Any";
|
|
1141
|
+
} | {
|
|
1142
|
+
readonly _tag: "Both";
|
|
1143
|
+
} | {
|
|
1144
|
+
readonly _tag: "OnlyGlobal";
|
|
1145
|
+
} | {
|
|
1146
|
+
readonly _tag: "OnlyLocal";
|
|
1147
|
+
}, {
|
|
1148
|
+
readonly _tag: Tag;
|
|
1149
|
+
}>) => any; }>(value: {
|
|
1150
|
+
readonly _tag: "Any";
|
|
1151
|
+
} | {
|
|
1152
|
+
readonly _tag: "Both";
|
|
1153
|
+
} | {
|
|
1154
|
+
readonly _tag: "OnlyGlobal";
|
|
1155
|
+
} | {
|
|
1156
|
+
readonly _tag: "OnlyLocal";
|
|
1157
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Any" | "Both" | "OnlyGlobal" | "OnlyLocal">]: never; }): Unify<ReturnType<Cases["Any" | "Both" | "OnlyGlobal" | "OnlyLocal"]>>;
|
|
1158
|
+
};
|
|
1159
|
+
readonly Any: Data.Case.Constructor<{
|
|
1160
|
+
readonly _tag: "Any";
|
|
1161
|
+
}, "_tag">;
|
|
1162
|
+
readonly Both: Data.Case.Constructor<{
|
|
1163
|
+
readonly _tag: "Both";
|
|
1164
|
+
}, "_tag">;
|
|
1165
|
+
readonly OnlyGlobal: Data.Case.Constructor<{
|
|
1166
|
+
readonly _tag: "OnlyGlobal";
|
|
1167
|
+
}, "_tag">;
|
|
1168
|
+
readonly OnlyLocal: Data.Case.Constructor<{
|
|
1169
|
+
readonly _tag: "OnlyLocal";
|
|
1170
|
+
}, "_tag">;
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
/** Where the tool must be found. @since 0.2.0 */
|
|
1174
|
+
export declare type SourceRequirementDefinition = {
|
|
1175
|
+
readonly Any: {};
|
|
1176
|
+
readonly OnlyLocal: {};
|
|
1177
|
+
readonly OnlyGlobal: {};
|
|
1178
|
+
readonly Both: {};
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
/** @since 0.2.0 */
|
|
1182
|
+
export declare type SyncResult = Data.TaggedEnum<SyncResultDefinition>;
|
|
1183
|
+
|
|
1184
|
+
/** @since 0.2.0 */
|
|
1185
|
+
export declare const SyncResult: {
|
|
1186
|
+
readonly $is: <Tag extends "Created" | "Unchanged" | "Updated">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
1187
|
+
readonly _tag: "Created";
|
|
1188
|
+
}, {
|
|
1189
|
+
readonly _tag: Tag;
|
|
1190
|
+
}> | Extract<{
|
|
1191
|
+
readonly _tag: "Unchanged";
|
|
1192
|
+
}, {
|
|
1193
|
+
readonly _tag: Tag;
|
|
1194
|
+
}> | Extract<{
|
|
1195
|
+
readonly _tag: "Updated";
|
|
1196
|
+
readonly diff: SectionDiff;
|
|
1197
|
+
}, {
|
|
1198
|
+
readonly _tag: Tag;
|
|
1199
|
+
}>;
|
|
1200
|
+
readonly $match: {
|
|
1201
|
+
<const Cases extends { readonly [Tag in "Created" | "Unchanged" | "Updated"]: (args: Extract<{
|
|
1202
|
+
readonly _tag: "Created";
|
|
1203
|
+
} | {
|
|
1204
|
+
readonly _tag: "Unchanged";
|
|
1205
|
+
} | {
|
|
1206
|
+
readonly _tag: "Updated";
|
|
1207
|
+
readonly diff: SectionDiff;
|
|
1208
|
+
}, {
|
|
1209
|
+
readonly _tag: Tag;
|
|
1210
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "Created" | "Unchanged" | "Updated">]: never; }): (value: {
|
|
1211
|
+
readonly _tag: "Created";
|
|
1212
|
+
} | {
|
|
1213
|
+
readonly _tag: "Unchanged";
|
|
1214
|
+
} | {
|
|
1215
|
+
readonly _tag: "Updated";
|
|
1216
|
+
readonly diff: SectionDiff;
|
|
1217
|
+
}) => Unify<ReturnType<Cases["Created" | "Unchanged" | "Updated"]>>;
|
|
1218
|
+
<const Cases extends { readonly [Tag in "Created" | "Unchanged" | "Updated"]: (args: Extract<{
|
|
1219
|
+
readonly _tag: "Created";
|
|
1220
|
+
} | {
|
|
1221
|
+
readonly _tag: "Unchanged";
|
|
1222
|
+
} | {
|
|
1223
|
+
readonly _tag: "Updated";
|
|
1224
|
+
readonly diff: SectionDiff;
|
|
1225
|
+
}, {
|
|
1226
|
+
readonly _tag: Tag;
|
|
1227
|
+
}>) => any; }>(value: {
|
|
1228
|
+
readonly _tag: "Created";
|
|
1229
|
+
} | {
|
|
1230
|
+
readonly _tag: "Unchanged";
|
|
1231
|
+
} | {
|
|
1232
|
+
readonly _tag: "Updated";
|
|
1233
|
+
readonly diff: SectionDiff;
|
|
1234
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Created" | "Unchanged" | "Updated">]: never; }): Unify<ReturnType<Cases["Created" | "Unchanged" | "Updated"]>>;
|
|
1235
|
+
};
|
|
1236
|
+
readonly Created: Data.Case.Constructor<{
|
|
1237
|
+
readonly _tag: "Created";
|
|
1238
|
+
}, "_tag">;
|
|
1239
|
+
readonly Unchanged: Data.Case.Constructor<{
|
|
1240
|
+
readonly _tag: "Unchanged";
|
|
1241
|
+
}, "_tag">;
|
|
1242
|
+
readonly Updated: Data.Case.Constructor<{
|
|
1243
|
+
readonly _tag: "Updated";
|
|
1244
|
+
readonly diff: SectionDiff;
|
|
1245
|
+
}, "_tag">;
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Result of a sync operation.
|
|
1250
|
+
*
|
|
1251
|
+
* @since 0.2.0
|
|
1252
|
+
*/
|
|
1253
|
+
export declare type SyncResultDefinition = {
|
|
1254
|
+
readonly Created: {};
|
|
1255
|
+
readonly Updated: {
|
|
1256
|
+
readonly diff: SectionDiff;
|
|
1257
|
+
};
|
|
1258
|
+
readonly Unchanged: {};
|
|
1259
|
+
};
|
|
1260
|
+
|
|
779
1261
|
/**
|
|
780
1262
|
* Raised when a git tag string cannot be formatted for the given package name and version.
|
|
781
1263
|
*
|
|
@@ -938,6 +1420,264 @@ declare const TargetResolver_base: Context.TagClass<TargetResolver, "@savvy-web/
|
|
|
938
1420
|
*/
|
|
939
1421
|
export declare const TargetResolverLive: Layer.Layer<TargetResolver, never, never>;
|
|
940
1422
|
|
|
1423
|
+
/**
|
|
1424
|
+
* Wraps `@effect/platform` {@link Command.Command} with instance method ergonomics.
|
|
1425
|
+
*
|
|
1426
|
+
* Use `yield* cmd.string()` instead of `yield* Command.string(cmd)`.
|
|
1427
|
+
*
|
|
1428
|
+
* @since 0.2.0
|
|
1429
|
+
*/
|
|
1430
|
+
export declare class ToolCommand {
|
|
1431
|
+
readonly command: Command.Command;
|
|
1432
|
+
constructor(command: Command.Command);
|
|
1433
|
+
string(encoding?: string): Effect.Effect<string, PlatformError, CommandExecutor.CommandExecutor>;
|
|
1434
|
+
exitCode(): Effect.Effect<number, PlatformError, CommandExecutor.CommandExecutor>;
|
|
1435
|
+
lines(encoding?: string): Effect.Effect<Array<string>, PlatformError, CommandExecutor.CommandExecutor>;
|
|
1436
|
+
stream(): Stream.Stream<Uint8Array, PlatformError, CommandExecutor.CommandExecutor>;
|
|
1437
|
+
env(environment: Record<string, string | undefined>): ToolCommand;
|
|
1438
|
+
workingDirectory(cwd: string): ToolCommand;
|
|
1439
|
+
stdin(input: string): ToolCommand;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* Declares a CLI tool's identity and resolution constraints.
|
|
1444
|
+
*
|
|
1445
|
+
* {@link Equal} compares on `name` only (identity).
|
|
1446
|
+
*
|
|
1447
|
+
* @since 0.2.0
|
|
1448
|
+
*/
|
|
1449
|
+
export declare class ToolDefinition implements Equal.Equal {
|
|
1450
|
+
readonly _tag: "ToolDefinition";
|
|
1451
|
+
readonly name: string;
|
|
1452
|
+
readonly versionExtractor: VersionExtractor;
|
|
1453
|
+
readonly policy: ResolutionPolicy;
|
|
1454
|
+
readonly source: SourceRequirement;
|
|
1455
|
+
private constructor();
|
|
1456
|
+
static make(options: {
|
|
1457
|
+
readonly name: string;
|
|
1458
|
+
readonly versionExtractor?: VersionExtractor;
|
|
1459
|
+
readonly policy?: ResolutionPolicy;
|
|
1460
|
+
readonly source?: SourceRequirement;
|
|
1461
|
+
}): ToolDefinition;
|
|
1462
|
+
[Equal.symbol](that: Equal.Equal): boolean;
|
|
1463
|
+
[Hash.symbol](): number;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* Service that resolves CLI tools — locating them globally (PATH) or locally
|
|
1468
|
+
* (via package manager), extracting versions, enforcing source and version
|
|
1469
|
+
* constraints, and caching results.
|
|
1470
|
+
*
|
|
1471
|
+
* @example
|
|
1472
|
+
* ```typescript
|
|
1473
|
+
* const result = await Effect.runPromise(
|
|
1474
|
+
* Effect.gen(function* () {
|
|
1475
|
+
* const td = yield* ToolDiscovery;
|
|
1476
|
+
* return yield* td.resolve(
|
|
1477
|
+
* ToolDefinition.make({ name: "biome" })
|
|
1478
|
+
* );
|
|
1479
|
+
* }).pipe(
|
|
1480
|
+
* Effect.provide(ToolDiscoveryLive),
|
|
1481
|
+
* Effect.provide(NodeContext.layer),
|
|
1482
|
+
* )
|
|
1483
|
+
* );
|
|
1484
|
+
* ```
|
|
1485
|
+
*
|
|
1486
|
+
* @since 0.2.0
|
|
1487
|
+
*/
|
|
1488
|
+
export declare class ToolDiscovery extends ToolDiscovery_base {
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
declare const ToolDiscovery_base: Context.TagClass<ToolDiscovery, "@savvy-web/silk-effects/ToolDiscovery", {
|
|
1492
|
+
/**
|
|
1493
|
+
* Resolve a tool definition to a {@link ResolvedTool}, enforcing source
|
|
1494
|
+
* requirements and resolution policies. Results are cached by tool name.
|
|
1495
|
+
*
|
|
1496
|
+
* @since 0.2.0
|
|
1497
|
+
*/
|
|
1498
|
+
readonly resolve: (definition: ToolDefinition) => Effect.Effect<ResolvedTool, ToolResolutionError>;
|
|
1499
|
+
/**
|
|
1500
|
+
* Like {@link resolve} but maps failures to {@link ToolNotFoundError}.
|
|
1501
|
+
* Accepts an optional custom error message.
|
|
1502
|
+
*
|
|
1503
|
+
* @since 0.2.0
|
|
1504
|
+
*/
|
|
1505
|
+
readonly require: {
|
|
1506
|
+
(definition: ToolDefinition): Effect.Effect<ResolvedTool, ToolNotFoundError>;
|
|
1507
|
+
(definition: ToolDefinition, message: string): Effect.Effect<ResolvedTool, ToolNotFoundError>;
|
|
1508
|
+
};
|
|
1509
|
+
/**
|
|
1510
|
+
* Quick availability check — returns `true` if the tool can be found
|
|
1511
|
+
* either globally or locally. Does not cache.
|
|
1512
|
+
*
|
|
1513
|
+
* @since 0.2.0
|
|
1514
|
+
*/
|
|
1515
|
+
readonly isAvailable: (definition: ToolDefinition) => Effect.Effect<boolean>;
|
|
1516
|
+
/**
|
|
1517
|
+
* Clear the internal resolution cache so subsequent calls re-run discovery.
|
|
1518
|
+
*
|
|
1519
|
+
* @since 0.2.0
|
|
1520
|
+
*/
|
|
1521
|
+
readonly clearCache: Effect.Effect<void>;
|
|
1522
|
+
}>;
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Live implementation of {@link ToolDiscovery}.
|
|
1526
|
+
*
|
|
1527
|
+
* @remarks
|
|
1528
|
+
* Requires `CommandExecutor` from `@effect/platform`, `PackageManagerDetector`
|
|
1529
|
+
* and `WorkspaceRoot` from `workspaces-effect`.
|
|
1530
|
+
*
|
|
1531
|
+
* @since 0.2.0
|
|
1532
|
+
*/
|
|
1533
|
+
export declare const ToolDiscoveryLive: Layer.Layer<ToolDiscovery, never, CommandExecutor.CommandExecutor | PackageManagerDetector | WorkspaceRoot>;
|
|
1534
|
+
|
|
1535
|
+
export declare class ToolNotFoundError extends ToolNotFoundError_base<{
|
|
1536
|
+
readonly name: string;
|
|
1537
|
+
readonly reason: string;
|
|
1538
|
+
}> {
|
|
1539
|
+
get message(): string;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
declare const ToolNotFoundError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1543
|
+
readonly _tag: "ToolNotFoundError";
|
|
1544
|
+
} & Readonly<A>;
|
|
1545
|
+
|
|
1546
|
+
export declare class ToolResolutionError extends ToolResolutionError_base<{
|
|
1547
|
+
readonly name: string;
|
|
1548
|
+
readonly reason: string;
|
|
1549
|
+
}> {
|
|
1550
|
+
get message(): string;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
declare const ToolResolutionError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1554
|
+
readonly _tag: "ToolResolutionError";
|
|
1555
|
+
} & Readonly<A>;
|
|
1556
|
+
|
|
1557
|
+
/** Where a tool was resolved from. @since 0.2.0 */
|
|
1558
|
+
export declare const ToolSource: Schema.Literal<["global", "local"]>;
|
|
1559
|
+
|
|
1560
|
+
/** @since 0.2.0 */
|
|
1561
|
+
export declare type ToolSource = typeof ToolSource.Type;
|
|
1562
|
+
|
|
1563
|
+
export declare class ToolVersionMismatchError extends ToolVersionMismatchError_base<{
|
|
1564
|
+
readonly name: string;
|
|
1565
|
+
readonly globalVersion: string;
|
|
1566
|
+
readonly localVersion: string;
|
|
1567
|
+
}> {
|
|
1568
|
+
get message(): string;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
declare const ToolVersionMismatchError_base: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1572
|
+
readonly _tag: "ToolVersionMismatchError";
|
|
1573
|
+
} & Readonly<A>;
|
|
1574
|
+
|
|
1575
|
+
/** @since 0.2.0 */
|
|
1576
|
+
export declare type VersionExtractor = Data.TaggedEnum<VersionExtractorDefinition>;
|
|
1577
|
+
|
|
1578
|
+
/** @since 0.2.0 */
|
|
1579
|
+
export declare const VersionExtractor: {
|
|
1580
|
+
readonly $is: <Tag extends "Flag" | "Json" | "None">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
1581
|
+
readonly _tag: "Flag";
|
|
1582
|
+
readonly flag: string;
|
|
1583
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1584
|
+
}, {
|
|
1585
|
+
readonly _tag: Tag;
|
|
1586
|
+
}> | Extract<{
|
|
1587
|
+
readonly _tag: "Json";
|
|
1588
|
+
readonly flag: string;
|
|
1589
|
+
readonly path: string;
|
|
1590
|
+
}, {
|
|
1591
|
+
readonly _tag: Tag;
|
|
1592
|
+
}> | Extract<{
|
|
1593
|
+
readonly _tag: "None";
|
|
1594
|
+
}, {
|
|
1595
|
+
readonly _tag: Tag;
|
|
1596
|
+
}>;
|
|
1597
|
+
readonly $match: {
|
|
1598
|
+
<const Cases extends { readonly [Tag in "Flag" | "Json" | "None"]: (args: Extract<{
|
|
1599
|
+
readonly _tag: "Flag";
|
|
1600
|
+
readonly flag: string;
|
|
1601
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1602
|
+
}, {
|
|
1603
|
+
readonly _tag: Tag;
|
|
1604
|
+
}> | Extract<{
|
|
1605
|
+
readonly _tag: "Json";
|
|
1606
|
+
readonly flag: string;
|
|
1607
|
+
readonly path: string;
|
|
1608
|
+
}, {
|
|
1609
|
+
readonly _tag: Tag;
|
|
1610
|
+
}> | Extract<{
|
|
1611
|
+
readonly _tag: "None";
|
|
1612
|
+
}, {
|
|
1613
|
+
readonly _tag: Tag;
|
|
1614
|
+
}>) => any; }>(cases: Cases & { [K in Exclude<keyof Cases, "Flag" | "Json" | "None">]: never; }): (value: {
|
|
1615
|
+
readonly _tag: "Flag";
|
|
1616
|
+
readonly flag: string;
|
|
1617
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1618
|
+
} | {
|
|
1619
|
+
readonly _tag: "Json";
|
|
1620
|
+
readonly flag: string;
|
|
1621
|
+
readonly path: string;
|
|
1622
|
+
} | {
|
|
1623
|
+
readonly _tag: "None";
|
|
1624
|
+
}) => Unify<ReturnType<Cases["Flag" | "Json" | "None"]>>;
|
|
1625
|
+
<const Cases extends { readonly [Tag in "Flag" | "Json" | "None"]: (args: Extract<{
|
|
1626
|
+
readonly _tag: "Flag";
|
|
1627
|
+
readonly flag: string;
|
|
1628
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1629
|
+
}, {
|
|
1630
|
+
readonly _tag: Tag;
|
|
1631
|
+
}> | Extract<{
|
|
1632
|
+
readonly _tag: "Json";
|
|
1633
|
+
readonly flag: string;
|
|
1634
|
+
readonly path: string;
|
|
1635
|
+
}, {
|
|
1636
|
+
readonly _tag: Tag;
|
|
1637
|
+
}> | Extract<{
|
|
1638
|
+
readonly _tag: "None";
|
|
1639
|
+
}, {
|
|
1640
|
+
readonly _tag: Tag;
|
|
1641
|
+
}>) => any; }>(value: {
|
|
1642
|
+
readonly _tag: "Flag";
|
|
1643
|
+
readonly flag: string;
|
|
1644
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1645
|
+
} | {
|
|
1646
|
+
readonly _tag: "Json";
|
|
1647
|
+
readonly flag: string;
|
|
1648
|
+
readonly path: string;
|
|
1649
|
+
} | {
|
|
1650
|
+
readonly _tag: "None";
|
|
1651
|
+
}, cases: Cases & { [K in Exclude<keyof Cases, "Flag" | "Json" | "None">]: never; }): Unify<ReturnType<Cases["Flag" | "Json" | "None"]>>;
|
|
1652
|
+
};
|
|
1653
|
+
readonly Flag: Data.Case.Constructor<{
|
|
1654
|
+
readonly _tag: "Flag";
|
|
1655
|
+
readonly flag: string;
|
|
1656
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1657
|
+
}, "_tag">;
|
|
1658
|
+
readonly Json: Data.Case.Constructor<{
|
|
1659
|
+
readonly _tag: "Json";
|
|
1660
|
+
readonly flag: string;
|
|
1661
|
+
readonly path: string;
|
|
1662
|
+
}, "_tag">;
|
|
1663
|
+
readonly None: Data.Case.Constructor<{
|
|
1664
|
+
readonly _tag: "None";
|
|
1665
|
+
}, "_tag">;
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
/** How to extract a version string from a CLI tool. @since 0.2.0 */
|
|
1669
|
+
export declare type VersionExtractorDefinition = {
|
|
1670
|
+
readonly Flag: {
|
|
1671
|
+
readonly flag: string;
|
|
1672
|
+
readonly parse?: ((output: string) => string) | undefined;
|
|
1673
|
+
};
|
|
1674
|
+
readonly Json: {
|
|
1675
|
+
readonly flag: string;
|
|
1676
|
+
readonly path: string;
|
|
1677
|
+
};
|
|
1678
|
+
readonly None: {};
|
|
1679
|
+
};
|
|
1680
|
+
|
|
941
1681
|
/**
|
|
942
1682
|
* Raised when the versioning strategy cannot be determined from the workspace state.
|
|
943
1683
|
*
|