@savvy-web/cli 2.1.14 → 2.1.15
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 +18 -18
- package/commands/changeset/commands/init.js +2 -1
- package/commands/changeset/utils/config-gate.js +2 -1
- package/commands/commit/hooks/post-commit-verify.js +3 -1
- package/commands/commit/lint.js +3 -1
- package/commands/lint/fmt.js +2 -1
- package/index.d.ts +8 -8
- package/package.json +3 -3
package/cli/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ToolDiscovery } from "@effected/commands";
|
|
|
10
10
|
import { Git } from "@effected/git";
|
|
11
11
|
import { ManagedSection } from "@effected/templates";
|
|
12
12
|
import { PackageManagerDetector, WorkspaceDiscovery, WorkspaceRoot, Workspaces } from "@effected/workspaces";
|
|
13
|
-
import {
|
|
13
|
+
import { BiomeSchemaSync, ChangesetConfigReader, Changesets, ConfigDiscovery, Repos, SilkPublishability } from "@savvy-web/silk-effects";
|
|
14
14
|
import { Effect, Layer } from "effect";
|
|
15
15
|
import { Command } from "effect/unstable/cli";
|
|
16
16
|
|
|
@@ -24,8 +24,8 @@ import { Command } from "effect/unstable/cli";
|
|
|
24
24
|
* single `savvy` root command, then provides the merged runtime Layer stack
|
|
25
25
|
* that satisfies every command's service requirements.
|
|
26
26
|
*
|
|
27
|
-
* The layer stack wires the silk-effects
|
|
28
|
-
* channels:
|
|
27
|
+
* The layer stack wires the silk-effects service layers over their v4
|
|
28
|
+
* requirement channels:
|
|
29
29
|
*
|
|
30
30
|
* - `NodeServices.layer` — `FileSystem`, `Path`, `ChildProcessSpawner`, `Stdio`,
|
|
31
31
|
* and `Terminal`, consumed by every config reader, workspace service, git
|
|
@@ -38,17 +38,17 @@ import { Command } from "effect/unstable/cli";
|
|
|
38
38
|
* `WorkspaceDiscovery.layer()` (the kit resolves the root through
|
|
39
39
|
* `WorkspaceRoot` from `process.cwd()` lazily on first use, so the CLI's
|
|
40
40
|
* startup cwd is the discovery root).
|
|
41
|
-
* - Flat silk-effects services — `
|
|
42
|
-
* `
|
|
43
|
-
* `@effected/templates`), `
|
|
44
|
-
* and `
|
|
41
|
+
* - Flat silk-effects services — `ChangesetConfigReader.layer`,
|
|
42
|
+
* `SilkPublishability.layer`, `ManagedSection.layer` (from
|
|
43
|
+
* `@effected/templates`), `BiomeSchemaSync.layer`,
|
|
44
|
+
* and `ConfigDiscovery.layer`. Tool resolution is the kit's
|
|
45
45
|
* `ToolDiscovery.layer` over `ChildProcessSpawner` plus a `LocalExec`, which
|
|
46
46
|
* `Workspaces.localExecLayer()` supplies from the detected package manager.
|
|
47
47
|
* Versioning classification
|
|
48
48
|
* is a pure `@effected/workspaces` value operation over `WorkspaceDiscovery`
|
|
49
49
|
* and the silk `PublishabilityDetector`, so it needs no layer of its own.
|
|
50
|
-
* - Changesets-namespace services — `Changesets.
|
|
51
|
-
* `Changesets.
|
|
50
|
+
* - Changesets-namespace services — `Changesets.ConfigInspector.layer`,
|
|
51
|
+
* `Changesets.ReleasePlanner.layer`, and `Changesets.BranchAnalyzer.layer`
|
|
52
52
|
* sharing a single `ConfigInspector` via `provideMerge`. `DepsRegen` is NOT
|
|
53
53
|
* part of AppLive: its graph is root-bound at layer build, so the deps
|
|
54
54
|
* commands compose `Changesets.makeDepsRegenDefault({ cwd })` per invocation
|
|
@@ -76,7 +76,7 @@ const rootCommand = Command.make("savvy").pipe(Command.withSubcommands([
|
|
|
76
76
|
* CLI application: reads argv from the Stdio service provided by NodeServices.
|
|
77
77
|
* (v4's `Command.run` takes only `version` — the name comes from the root command.)
|
|
78
78
|
*/
|
|
79
|
-
const cli = Command.run(rootCommand, { version: "2.1.
|
|
79
|
+
const cli = Command.run(rootCommand, { version: "2.1.15" });
|
|
80
80
|
/**
|
|
81
81
|
* Shared workspace services from `@effected/workspaces`, wired as a
|
|
82
82
|
* self-contained unit and built ONCE (layers memoize by reference).
|
|
@@ -100,22 +100,22 @@ const GitLive = Git.layer;
|
|
|
100
100
|
* (`WorkspaceLive`, `ChangesetConfigReader`, `GitLive`) that `AppLive`'s
|
|
101
101
|
* upper services build upon.
|
|
102
102
|
*/
|
|
103
|
-
const BaseLive = Layer.mergeAll(WorkspaceLive, GitLive,
|
|
103
|
+
const BaseLive = Layer.mergeAll(WorkspaceLive, GitLive, ChangesetConfigReader.layer, ManagedSection.layer, BiomeSchemaSync.layer, ConfigDiscovery.layer, SilkPublishability.layer);
|
|
104
104
|
/**
|
|
105
|
-
* `
|
|
106
|
-
* feeds that single `ConfigInspector` instance into `
|
|
107
|
-
* `
|
|
105
|
+
* `ConfigInspector.layer` is built once via {@link Layer.provideMerge}: the merge
|
|
106
|
+
* feeds that single `ConfigInspector` instance into `ReleasePlanner.layer` and
|
|
107
|
+
* `BranchAnalyzer.layer` AND re-exposes it for the surviving `config validate`
|
|
108
108
|
* handler that yields it directly, so it is never constructed twice per run.
|
|
109
|
-
* `
|
|
109
|
+
* `BranchAnalyzer.layer`'s v4 requirements are `ConfigInspector |
|
|
110
110
|
* ChildProcessSpawner` (the spawner flows up to `NodeServices.layer`).
|
|
111
111
|
*/
|
|
112
|
-
const InspectorAndAnalyzerLive = Changesets.
|
|
112
|
+
const InspectorAndAnalyzerLive = Changesets.BranchAnalyzer.layer.pipe(Layer.provideMerge(Changesets.ReleasePlanner.layer), Layer.provideMerge(Changesets.ConfigInspector.layer));
|
|
113
113
|
/**
|
|
114
|
-
* `Repos.ReposManager`, provided its `Repos.
|
|
114
|
+
* `Repos.ReposManager`, provided its `Repos.ReposConfigStore.layer` dependency
|
|
115
115
|
* and the shared `Git` service. Platform requirements (`FileSystem`, `Path`)
|
|
116
116
|
* flow up to `NodeServices.layer`.
|
|
117
117
|
*/
|
|
118
|
-
const ReposGroupLive = Repos.
|
|
118
|
+
const ReposGroupLive = Repos.ReposManager.layer.pipe(Layer.provide(Repos.ReposConfigStore.layer), Layer.provide(GitLive));
|
|
119
119
|
/**
|
|
120
120
|
* `ToolDiscovery` from `@effected/commands`, wired to this workspace. Its
|
|
121
121
|
* `LocalExec` contract — the argv prefix that runs a project-local binary — is
|
|
@@ -420,7 +420,8 @@ function handleChangesetMarkdownlint(changesetDir, root, force) {
|
|
|
420
420
|
* @internal
|
|
421
421
|
*/
|
|
422
422
|
function checkChangesetDir(root) {
|
|
423
|
-
|
|
423
|
+
const dir = join(root, ".changeset");
|
|
424
|
+
if (!existsSync(dir)) return [{
|
|
424
425
|
file: ".changeset/",
|
|
425
426
|
message: "directory does not exist"
|
|
426
427
|
}];
|
|
@@ -47,7 +47,8 @@ const { ConfigInspector } = Changesets;
|
|
|
47
47
|
function requireValidConfig(cwd) {
|
|
48
48
|
return Effect.gen(function* () {
|
|
49
49
|
const projectDir = resolve(cwd);
|
|
50
|
-
|
|
50
|
+
const configPath = join(projectDir, ".changeset", "config.json");
|
|
51
|
+
if (!existsSync(configPath)) return;
|
|
51
52
|
yield* (yield* ConfigInspector).inspect(projectDir).pipe(Effect.catchTag("ConfigurationError", (err) => {
|
|
52
53
|
process.exitCode = 1;
|
|
53
54
|
return Effect.fail(err);
|
|
@@ -35,7 +35,9 @@ const getRepoRoot = Effect.gen(function* () {
|
|
|
35
35
|
});
|
|
36
36
|
function runCommitlintLast(root) {
|
|
37
37
|
return (async () => {
|
|
38
|
-
const
|
|
38
|
+
const pm = await Commitlint.detectPackageManager(root);
|
|
39
|
+
const configPath = await Commitlint.readCommitlintConfigPath(root);
|
|
40
|
+
const { command, args } = buildCommitlintInvocation(pm, configPath, ["--last"]);
|
|
39
41
|
try {
|
|
40
42
|
await execFileP(command, args, { cwd: root });
|
|
41
43
|
return false;
|
package/commands/commit/lint.js
CHANGED
|
@@ -36,7 +36,9 @@ const getRepoRoot = Effect.gen(function* () {
|
|
|
36
36
|
*/
|
|
37
37
|
function runCommitlintEdit(root, file) {
|
|
38
38
|
return (async () => {
|
|
39
|
-
const
|
|
39
|
+
const pm = await Commitlint.detectPackageManager(root);
|
|
40
|
+
const configPath = await Commitlint.readCommitlintConfigPath(root);
|
|
41
|
+
const { command, args } = buildCommitlintInvocation(pm, configPath, ["--edit", file]);
|
|
40
42
|
try {
|
|
41
43
|
const { stdout, stderr } = await execFileP(command, args, { cwd: root });
|
|
42
44
|
return {
|
package/commands/lint/fmt.js
CHANGED
|
@@ -32,7 +32,8 @@ const pnpmWorkspaceCommand = Command.make("pnpm-workspace", {}, () => Effect.gen
|
|
|
32
32
|
const content = readFileSync(filepath, "utf-8");
|
|
33
33
|
const parsed = yield* Yaml.parse(content);
|
|
34
34
|
const sorted = Lint.PnpmWorkspace.sortContent(parsed);
|
|
35
|
-
|
|
35
|
+
const formatted = yield* Effect.promise(() => Lint.PnpmWorkspace.formatContent(sorted));
|
|
36
|
+
writeFileSync(filepath, formatted, "utf-8");
|
|
36
37
|
}));
|
|
37
38
|
/** Format YAML files with Prettier. */
|
|
38
39
|
const yamlCommand = Command.make("yaml", { files: filesArg }, ({ files }) => Effect.gen(function* () {
|
package/index.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ import { JsoncParseError } from "@effected/jsonc";
|
|
|
18
18
|
* single `savvy` root command, then provides the merged runtime Layer stack
|
|
19
19
|
* that satisfies every command's service requirements.
|
|
20
20
|
*
|
|
21
|
-
* The layer stack wires the silk-effects
|
|
22
|
-
* channels:
|
|
21
|
+
* The layer stack wires the silk-effects service layers over their v4
|
|
22
|
+
* requirement channels:
|
|
23
23
|
*
|
|
24
24
|
* - `NodeServices.layer` — `FileSystem`, `Path`, `ChildProcessSpawner`, `Stdio`,
|
|
25
25
|
* and `Terminal`, consumed by every config reader, workspace service, git
|
|
@@ -32,17 +32,17 @@ import { JsoncParseError } from "@effected/jsonc";
|
|
|
32
32
|
* `WorkspaceDiscovery.layer()` (the kit resolves the root through
|
|
33
33
|
* `WorkspaceRoot` from `process.cwd()` lazily on first use, so the CLI's
|
|
34
34
|
* startup cwd is the discovery root).
|
|
35
|
-
* - Flat silk-effects services — `
|
|
36
|
-
* `
|
|
37
|
-
* `@effected/templates`), `
|
|
38
|
-
* and `
|
|
35
|
+
* - Flat silk-effects services — `ChangesetConfigReader.layer`,
|
|
36
|
+
* `SilkPublishability.layer`, `ManagedSection.layer` (from
|
|
37
|
+
* `@effected/templates`), `BiomeSchemaSync.layer`,
|
|
38
|
+
* and `ConfigDiscovery.layer`. Tool resolution is the kit's
|
|
39
39
|
* `ToolDiscovery.layer` over `ChildProcessSpawner` plus a `LocalExec`, which
|
|
40
40
|
* `Workspaces.localExecLayer()` supplies from the detected package manager.
|
|
41
41
|
* Versioning classification
|
|
42
42
|
* is a pure `@effected/workspaces` value operation over `WorkspaceDiscovery`
|
|
43
43
|
* and the silk `PublishabilityDetector`, so it needs no layer of its own.
|
|
44
|
-
* - Changesets-namespace services — `Changesets.
|
|
45
|
-
* `Changesets.
|
|
44
|
+
* - Changesets-namespace services — `Changesets.ConfigInspector.layer`,
|
|
45
|
+
* `Changesets.ReleasePlanner.layer`, and `Changesets.BranchAnalyzer.layer`
|
|
46
46
|
* sharing a single `ConfigInspector` via `provideMerge`. `DepsRegen` is NOT
|
|
47
47
|
* part of AppLive: its graph is root-bound at layer build, so the deps
|
|
48
48
|
* commands compose `Changesets.makeDepsRegenDefault({ cwd })` per invocation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
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,9 +36,9 @@
|
|
|
36
36
|
"@effected/git": "^0.5.1",
|
|
37
37
|
"@effected/jsonc": "^0.5.1",
|
|
38
38
|
"@effected/templates": "^0.1.0",
|
|
39
|
-
"@effected/workspaces": "^0.9.
|
|
39
|
+
"@effected/workspaces": "^0.9.3",
|
|
40
40
|
"@effected/yaml": "^0.6.0",
|
|
41
|
-
"@savvy-web/silk-effects": "5.
|
|
41
|
+
"@savvy-web/silk-effects": "5.2.0",
|
|
42
42
|
"effect": "4.0.0-beta.101"
|
|
43
43
|
}
|
|
44
44
|
}
|