@savvy-web/cli 1.3.6 → 1.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/cli/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { initCommand } from "../commands/init.js";
|
|
|
6
6
|
import { lintCommand } from "../commands/lint/index.js";
|
|
7
7
|
import { Command } from "@effect/cli";
|
|
8
8
|
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
9
|
-
import { BiomeSchemaSyncLive, ChangesetConfigReaderLive, Changesets, ConfigDiscoveryLive, ManagedSectionLive, SilkPublishabilityDetectorLive, ToolDiscoveryLive, VersioningStrategyLive } from "@savvy-web/silk-effects";
|
|
9
|
+
import { BiomeSchemaSyncLive, ChangesetConfigLive, ChangesetConfigReaderLive, Changesets, ConfigDiscoveryLive, ManagedSectionLive, SilkPublishabilityDetectorLive, ToolDiscoveryLive, VersioningStrategyLive } from "@savvy-web/silk-effects";
|
|
10
10
|
import { Effect, Layer } from "effect";
|
|
11
|
-
import {
|
|
11
|
+
import { PackageManagerDetectorLive, PointInTimeWorkspaceLive, PublishabilityDetectorLive, WorkspaceDiscoveryLive, WorkspaceRootLive } from "workspaces-effect";
|
|
12
12
|
|
|
13
13
|
//#region src/cli/index.ts
|
|
14
14
|
/**
|
|
@@ -34,10 +34,9 @@ import { CatalogResolverLive, LockfileReaderLive, PackageManagerDetectorLive, Pu
|
|
|
34
34
|
* `ConfigDiscoveryLive`, `ToolDiscoveryLive`, and `VersioningStrategyLive`
|
|
35
35
|
* (provided `ChangesetConfigReaderLive`).
|
|
36
36
|
* - Changesets-namespace services — `Changesets.ConfigInspectorLive` (provided
|
|
37
|
-
* `ChangesetConfigReaderLive`), `Changesets.
|
|
38
|
-
* `
|
|
39
|
-
* `
|
|
40
|
-
* instance built once via `provideMerge`.
|
|
37
|
+
* `ChangesetConfigReaderLive`), `Changesets.ReleasePlannerLive` (provided
|
|
38
|
+
* `ConfigInspectorLive`), and `Changesets.BranchAnalyzerLive`, which shares
|
|
39
|
+
* the single `ConfigInspectorLive` instance built once via `provideMerge`.
|
|
41
40
|
*
|
|
42
41
|
* The CLI version is injected at build time via `process.env.__PACKAGE_VERSION__`.
|
|
43
42
|
*
|
|
@@ -57,7 +56,7 @@ const rootCommand = Command.make("savvy").pipe(Command.withSubcommands([
|
|
|
57
56
|
]));
|
|
58
57
|
const cli = Command.run(rootCommand, {
|
|
59
58
|
name: "savvy",
|
|
60
|
-
version: "1.
|
|
59
|
+
version: "1.4.0"
|
|
61
60
|
});
|
|
62
61
|
/**
|
|
63
62
|
* Shared base layer: workspace services, the changeset config reader, and the
|
|
@@ -77,12 +76,12 @@ const cli = Command.run(rootCommand, {
|
|
|
77
76
|
const WorkspaceLive = Layer.mergeAll(WorkspaceRootLive, PackageManagerDetectorLive, WorkspaceDiscoveryLive.pipe(Layer.provide(WorkspaceRootLive)));
|
|
78
77
|
/**
|
|
79
78
|
* Base layer membership: silk-effects leaf services (`ManagedSection`,
|
|
80
|
-
* `BiomeSchemaSync`, `ConfigDiscovery`, `SilkPublishabilityDetector
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
79
|
+
* `BiomeSchemaSync`, `ConfigDiscovery`, `SilkPublishabilityDetector`) that
|
|
80
|
+
* depend only on the platform, plus the changeset base layers
|
|
81
|
+
* (`WorkspaceLive`, `ChangesetConfigReader`) that `AppLive`'s upper services
|
|
82
|
+
* build upon.
|
|
84
83
|
*/
|
|
85
|
-
const BaseLive = Layer.mergeAll(WorkspaceLive, ChangesetConfigReaderLive, ManagedSectionLive, BiomeSchemaSyncLive, ConfigDiscoveryLive, SilkPublishabilityDetectorLive
|
|
84
|
+
const BaseLive = Layer.mergeAll(WorkspaceLive, ChangesetConfigReaderLive, ManagedSectionLive, BiomeSchemaSyncLive, ConfigDiscoveryLive, SilkPublishabilityDetectorLive);
|
|
86
85
|
/**
|
|
87
86
|
* Merged runtime Layer stack — the union of the three source CLIs' stacks with
|
|
88
87
|
* every inter-layer dependency satisfied.
|
|
@@ -103,14 +102,15 @@ const BaseLive = Layer.mergeAll(WorkspaceLive, ChangesetConfigReaderLive, Manage
|
|
|
103
102
|
* handler that yields it directly, so it is never constructed twice per run.
|
|
104
103
|
*
|
|
105
104
|
* `Changesets.DepsRegenLive` (the `deps regen`/`deps detect` orchestration
|
|
106
|
-
* service) needs `
|
|
107
|
-
* `
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* `FileSystem`, `Path` —
|
|
105
|
+
* service) needs `ConfigInspector`, `WorkspaceDiscovery` (from
|
|
106
|
+
* `BaseLive`/`InspectorAndAnalyzerLive`), plus `PointInTimeWorkspace` and
|
|
107
|
+
* `PublishabilityDetector` from `workspaces-effect`, and `ChangesetConfig`
|
|
108
|
+
* (provided its own `ChangesetConfigReaderLive`, since `Layer.mergeAll` does
|
|
109
|
+
* not cross-feed sibling layers) — none of which the other commands need, so
|
|
110
|
+
* they're composed only for `DepsRegenGroupLive`. `PointInTimeWorkspaceLive`
|
|
111
|
+
* in turn needs `WorkspaceRoot`, `WorkspaceDiscovery`, `CommandExecutor`,
|
|
112
|
+
* `FileSystem`, `Path` — the workspace pair supplied by `WorkspaceLive`, the
|
|
113
|
+
* platform trio by `NodeContext.layer` below.
|
|
114
114
|
* `DepsRegenGroupLive` reuses the exact `InspectorAndAnalyzerLive` layer
|
|
115
115
|
* reference (not a fresh copy), so Effect's layer memoization builds that
|
|
116
116
|
* single `ConfigInspector` instance once and shares it here too.
|
|
@@ -121,17 +121,13 @@ const BaseLive = Layer.mergeAll(WorkspaceLive, ChangesetConfigReaderLive, Manage
|
|
|
121
121
|
*/
|
|
122
122
|
const InspectorAndAnalyzerLive = Changesets.BranchAnalyzerLive.pipe(Layer.provideMerge(Changesets.ReleasePlannerLive), Layer.provideMerge(Changesets.ConfigInspectorLive));
|
|
123
123
|
/**
|
|
124
|
-
* `CatalogResolver` composed with its own `LockfileReader` dependency. The
|
|
125
|
-
* remaining requirements of both (`WorkspaceRoot`, `WorkspaceDiscovery`,
|
|
126
|
-
* `PackageManagerDetector`, `FileSystem`, `Path`) are left open, satisfied
|
|
127
|
-
* by `BaseLive` / `NodeContext.layer` in `AppLive` below.
|
|
128
|
-
*/
|
|
129
|
-
const CatalogLive = CatalogResolverLive.pipe(Layer.provide(LockfileReaderLive));
|
|
130
|
-
/**
|
|
131
124
|
* `Changesets.DepsRegen`, fully composed except for the base services
|
|
132
|
-
* (`
|
|
125
|
+
* (`WorkspaceDiscovery`, platform layers) supplied by `BaseLive` /
|
|
126
|
+
* `NodeContext.layer`. `PointInTimeWorkspaceLive` is provided `WorkspaceLive`
|
|
127
|
+
* so its `WorkspaceRoot`/`WorkspaceDiscovery` requirements resolve; the
|
|
128
|
+
* remaining `CommandExecutor`/`FileSystem`/`Path` flow up to `NodeContext.layer`.
|
|
133
129
|
*/
|
|
134
|
-
const DepsRegenGroupLive = Changesets.DepsRegenLive.pipe(Layer.provide(InspectorAndAnalyzerLive), Layer.provide(
|
|
130
|
+
const DepsRegenGroupLive = Changesets.DepsRegenLive.pipe(Layer.provide(InspectorAndAnalyzerLive), Layer.provide(PointInTimeWorkspaceLive.pipe(Layer.provide(WorkspaceLive))), Layer.provide(PublishabilityDetectorLive), Layer.provide(ChangesetConfigLive.pipe(Layer.provide(ChangesetConfigReaderLive))));
|
|
135
131
|
const AppLive = Layer.mergeAll(ToolDiscoveryLive, VersioningStrategyLive, InspectorAndAnalyzerLive, DepsRegenGroupLive).pipe(Layer.provideMerge(BaseLive), Layer.provideMerge(NodeContext.layer));
|
|
136
132
|
/**
|
|
137
133
|
* Bootstrap and run the `savvy` CLI application.
|
|
@@ -64,9 +64,15 @@ function runDepsDetect(cwd, from, to, pkg, json, markdown) {
|
|
|
64
64
|
...Option.isSome(pkg) ? { package: pkg.value } : {},
|
|
65
65
|
...Option.isSome(from) ? { from: from.value } : {},
|
|
66
66
|
...Option.isSome(to) ? { to: to.value } : {}
|
|
67
|
-
}).pipe(Effect.
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
}).pipe(Effect.catchTags({
|
|
68
|
+
GitError: (err) => {
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
return Effect.fail(err);
|
|
71
|
+
},
|
|
72
|
+
GitReadError: (err) => {
|
|
73
|
+
process.exitCode = 1;
|
|
74
|
+
return Effect.fail(err);
|
|
75
|
+
}
|
|
70
76
|
}))).toWrite.map((entry) => entry.diff);
|
|
71
77
|
if (markdown && !json) {
|
|
72
78
|
yield* Effect.log(renderMarkdownBlocks(diffs));
|
|
@@ -65,9 +65,15 @@ function runDepsRegen(cwd, base, pkg, dryRun, json) {
|
|
|
65
65
|
cwd,
|
|
66
66
|
...Option.isSome(base) ? { base: base.value } : {},
|
|
67
67
|
...Option.isSome(pkg) ? { package: pkg.value } : {}
|
|
68
|
-
}).pipe(Effect.
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
}).pipe(Effect.catchTags({
|
|
69
|
+
GitError: (err) => {
|
|
70
|
+
process.exitCode = 1;
|
|
71
|
+
return Effect.fail(err);
|
|
72
|
+
},
|
|
73
|
+
GitReadError: (err) => {
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
return Effect.fail(err);
|
|
76
|
+
}
|
|
71
77
|
}));
|
|
72
78
|
if (!dryRun) yield* service.execute(plan);
|
|
73
79
|
if (json) yield* Console.log(JSON.stringify(plan, null, 2));
|
package/index.d.ts
CHANGED
|
@@ -30,10 +30,9 @@ import { JsoncParseError } from "jsonc-effect";
|
|
|
30
30
|
* `ConfigDiscoveryLive`, `ToolDiscoveryLive`, and `VersioningStrategyLive`
|
|
31
31
|
* (provided `ChangesetConfigReaderLive`).
|
|
32
32
|
* - Changesets-namespace services — `Changesets.ConfigInspectorLive` (provided
|
|
33
|
-
* `ChangesetConfigReaderLive`), `Changesets.
|
|
34
|
-
* `
|
|
35
|
-
* `
|
|
36
|
-
* instance built once via `provideMerge`.
|
|
33
|
+
* `ChangesetConfigReaderLive`), `Changesets.ReleasePlannerLive` (provided
|
|
34
|
+
* `ConfigInspectorLive`), and `Changesets.BranchAnalyzerLive`, which shares
|
|
35
|
+
* the single `ConfigInspectorLive` instance built once via `provideMerge`.
|
|
37
36
|
*
|
|
38
37
|
* The CLI version is injected at build time via `process.env.__PACKAGE_VERSION__`.
|
|
39
38
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The savvy CLI — unified commit, changeset, and lint commands for the Silk Suite",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/systems/tree/main/packages/cli",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@effect/platform-node": "^0.107.0",
|
|
37
37
|
"@effect/rpc": "^0.75.1",
|
|
38
38
|
"@effect/sql": "^0.51.1",
|
|
39
|
-
"@savvy-web/silk-effects": "
|
|
39
|
+
"@savvy-web/silk-effects": "2.0.0",
|
|
40
40
|
"effect": "^3.21.4",
|
|
41
41
|
"jsonc-effect": "^0.3.0",
|
|
42
|
-
"workspaces-effect": "^
|
|
42
|
+
"workspaces-effect": "^2.0.0",
|
|
43
43
|
"yaml": "^2.9.0"
|
|
44
44
|
}
|
|
45
45
|
}
|