@savvy-web/silk-core 0.1.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/LICENSE +21 -0
- package/README.md +47 -0
- package/_virtual/_rolldown/runtime.js +18 -0
- package/errors/BiomeSyncError.js +22 -0
- package/errors/ChangesetConfigError.js +21 -0
- package/errors/ConfigNotFoundError.js +22 -0
- package/errors/PublishTargetBindingError.js +30 -0
- package/errors/WorkspaceAnalysisError.js +22 -0
- package/index.d.ts +1261 -0
- package/index.js +15 -0
- package/package.json +39 -0
- package/pr-body/body.js +145 -0
- package/pr-body/diagnostics.js +104 -0
- package/pr-body/index.js +22 -0
- package/pr-body/linked-issue.js +44 -0
- package/pr-body/markers.js +103 -0
- package/pr-body/references.js +157 -0
- package/pr-body/region.js +105 -0
- package/schemas/BiomeConfig.js +36 -0
- package/schemas/ConfigDiscoverySchemas.js +50 -0
- package/schemas/SavvyInstallSection.js +232 -0
- package/schemas/SavvySections.js +194 -0
- package/schemas/VersioningSchemas.js +87 -0
- package/schemas/WorkspaceAnalysisSchemas.js +209 -0
- package/tsdoc-metadata.json +11 -0
- package/utils/TrailingSlash.js +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Savvy Web Systems
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @savvy-web/silk-core
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@savvy-web/silk-core)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
The platform-free domain core of the Silk Suite: the [Effect](https://effect.website/) schemas, tagged errors and the PR-body contract that every other Silk package builds on. Nothing in this package touches a filesystem, a subprocess, a clock or `process` — it is pure data modelling, safe to import from any runtime.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Workspace-analysis schemas — `AnalyzedWorkspace`, `WorkspaceAnalysis` and the Silk-extended `SilkPublishConfig` with its multi-registry `targets`
|
|
11
|
+
- Changeset config file schemas (`ChangesetConfigFile`, `SilkChangesetConfigFile`) and the config-discovery result types
|
|
12
|
+
- The managed `savvy-*` shell sections (`SavvyBaseSection`, `SavvyHooksSection`, `SavvyInstallSection`, `SavvyToolchainSection`) and their block builders
|
|
13
|
+
- The frozen `PrBody` contract — `silk-release` markers, managed regions, closing-reference spellings and diagnostics — shared by every PR-body writer
|
|
14
|
+
- Typed errors (`BiomeSyncError`, `ChangesetConfigError`, `ConfigNotFoundError`, `PublishTargetBindingError`, `WorkspaceAnalysisError`)
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add @savvy-web/silk-core effect @effected/workspaces
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`effect` and `@effected/workspaces` are peer dependencies.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { PrBody, SilkPublishConfig } from "@savvy-web/silk-core";
|
|
28
|
+
import { Schema } from "effect";
|
|
29
|
+
|
|
30
|
+
const config = Schema.decodeUnknownSync(SilkPublishConfig)({
|
|
31
|
+
access: "public",
|
|
32
|
+
targets: ["npm", "github"],
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const body = PrBody.ManagedPrBody.build({
|
|
36
|
+
subject: "feat(silk-core): extract domain core",
|
|
37
|
+
linkedIssues: [PrBody.LinkedIssueRef.make({ number: 419, title: "Share the PR-body contract", state: "open" })],
|
|
38
|
+
signoff: "Signed-off-by: C. Spencer Beggs <spencer@savvyweb.systems>",
|
|
39
|
+
summary: "Extract the domain core.",
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Most consumers reach these symbols through `@savvy-web/silk-effects`, which re-exports the whole surface under the same names alongside the platform-backed services. Depend on `@savvy-web/silk-core` directly when you only need the data model.
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) {
|
|
6
|
+
__defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!no_symbols) {
|
|
12
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __exportAll };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/BiomeSyncError.ts
|
|
4
|
+
/**
|
|
5
|
+
* Raised when a Biome config file cannot be read or its `$schema` URL cannot be updated.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Returned by `BiomeSchemaSync.sync` and `BiomeSchemaSync.check` when
|
|
9
|
+
* a `biome.json` or `biome.jsonc` file exists but cannot be read, contains invalid JSON,
|
|
10
|
+
* or cannot be written back to disk.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.1.0
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
var BiomeSyncError = class extends Data.TaggedError("BiomeSyncError") {
|
|
16
|
+
get message() {
|
|
17
|
+
return `Failed to sync biome schema in ${this.path}: ${this.reason}`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { BiomeSyncError };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/ChangesetConfigError.ts
|
|
4
|
+
/**
|
|
5
|
+
* Raised when the `.changeset/config.json` file cannot be read or decoded.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Returned by `ChangesetConfigReader.read` when the file is missing,
|
|
9
|
+
* contains invalid JSON, or fails Effect Schema validation.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
var ChangesetConfigError = class extends Data.TaggedError("ChangesetConfigError") {
|
|
15
|
+
get message() {
|
|
16
|
+
return `Failed to read changeset config at ${this.path}: ${this.reason}`;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ChangesetConfigError };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/ConfigNotFoundError.ts
|
|
4
|
+
/**
|
|
5
|
+
* Raised when a config file cannot be located in any of the expected locations.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Returned by consumers that require a config file to exist. `ConfigDiscovery.find`
|
|
9
|
+
* itself returns `null` instead of failing — callers that need a hard failure should
|
|
10
|
+
* map `null` to this error.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.1.0
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
var ConfigNotFoundError = class extends Data.TaggedError("ConfigNotFoundError") {
|
|
16
|
+
get message() {
|
|
17
|
+
return `Config '${this.name}' not found. Searched: ${this.searchedPaths.join(", ")}`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ConfigNotFoundError };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/PublishTargetBindingError.ts
|
|
4
|
+
/**
|
|
5
|
+
* Raised when publishability detection selects a directory that the package's
|
|
6
|
+
* `dist/prod/targets.json` binding does not describe.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The bundler's prod build writes `targets.json` naming every byte-group
|
|
10
|
+
* directory it produced. Once that binding exists it is authoritative: the only
|
|
11
|
+
* directories whose bytes may be published are the ones it lists. A detector
|
|
12
|
+
* that returns anything else — most often `publishConfig.directory` pointing at
|
|
13
|
+
* a **dev** build, because silk mode was misdetected — is about to pack an
|
|
14
|
+
* unresolved workspace manifest and ship it to a registry.
|
|
15
|
+
*
|
|
16
|
+
* That is the `yaml-effect@0.7.1` failure: detection picked `dist/dev/pkg`, the
|
|
17
|
+
* dev manifest still carried `catalog:` specifiers, and the published package
|
|
18
|
+
* was uninstallable (`EUNSUPPORTEDPROTOCOL`).
|
|
19
|
+
*
|
|
20
|
+
* @since 3.1.0
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
var PublishTargetBindingError = class extends Data.TaggedError("PublishTargetBindingError") {
|
|
24
|
+
get message() {
|
|
25
|
+
return `Package ${this.pkg} resolved publish directory "${this.directory}", which is not one of the directories bound by dist/prod/targets.json (${this.boundDirectories.join(", ")}). This means publishability detection did not select the prod build output — refusing to publish before packing an unresolved manifest.`;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { PublishTargetBindingError };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/WorkspaceAnalysisError.ts
|
|
4
|
+
/**
|
|
5
|
+
* Raised when workspace analysis fails for a given root directory.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Returned by `SilkWorkspaceAnalyzer.analyze` when the analysis pipeline
|
|
9
|
+
* encounters an unrecoverable error — e.g. workspace discovery failure,
|
|
10
|
+
* package manager detection failure, or publishability detection errors.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.2.0
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
var WorkspaceAnalysisError = class extends Data.TaggedError("WorkspaceAnalysisError") {
|
|
16
|
+
get message() {
|
|
17
|
+
return `Workspace analysis failed at ${this.root}: ${this.reason}`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { WorkspaceAnalysisError };
|