@savvy-web/cli 2.11.4 → 3.0.1
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 +3 -3
- package/bin/savvy.js +5 -10
- package/cli/index.js +13 -27
- package/commands/changeset/commands/check.js +2 -2
- package/commands/changeset/commands/config-validate.js +2 -2
- package/commands/changeset/commands/deps-detect.js +2 -2
- package/commands/changeset/commands/deps-regen.js +2 -2
- package/commands/changeset/commands/init.js +3 -3
- package/commands/changeset/commands/lint.js +2 -2
- package/commands/changeset/commands/transform.js +2 -2
- package/commands/changeset/commands/validate-file.js +1 -1
- package/commands/changeset/commands/version.js +1 -1
- package/commands/changeset/utils/config-gate.js +1 -1
- package/commands/check.js +2 -2
- package/commands/clean.js +2 -2
- package/commands/commit/check.js +2 -2
- package/commands/commit/hooks/post-commit-verify.js +2 -2
- package/commands/commit/hooks/pre-commit-message.js +2 -2
- package/commands/commit/hooks/session-start.js +2 -2
- package/commands/commit/init.js +2 -2
- package/commands/commit/lint.js +2 -2
- package/commands/init.js +2 -2
- package/commands/lint/check.js +7 -3
- package/commands/lint/fmt.js +1 -1
- package/commands/lint/init.js +8 -8
- package/commands/repos/commands/add.js +1 -1
- package/commands/repos/commands/deregister.js +1 -1
- package/commands/repos/commands/note.js +1 -1
- package/commands/repos/commands/pin.js +1 -1
- package/commands/repos/commands/remove.js +1 -1
- package/commands/repos/commands/rename.js +1 -1
- package/commands/repos/commands/restore.js +1 -1
- package/commands/repos/commands/status.js +1 -1
- package/commands/repos/commands/sync.js +1 -1
- package/index.d.ts +0 -59
- package/index.js +1 -2
- package/main.d.ts +7 -0
- package/main.js +35 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -91,12 +91,12 @@ npx savvy changeset --help
|
|
|
91
91
|
The package also exports the assembled command tree and its handlers for embedding `savvy` in another program:
|
|
92
92
|
|
|
93
93
|
```ts
|
|
94
|
-
import {
|
|
94
|
+
import { main } from "@savvy-web/cli/main";
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
main();
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
The
|
|
99
|
+
The `.` barrel exports the command groups (`changesetCommand`, `commitCommand`, `lintCommand`) and their named handlers only.
|
|
100
100
|
|
|
101
101
|
## License
|
|
102
102
|
|
package/bin/savvy.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { main } from "../main.js";
|
|
3
3
|
|
|
4
|
-
//#region src/bin
|
|
4
|
+
//#region src/bin.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* This file is the `bin` target in `package.json`. It delegates immediately
|
|
9
|
-
* to {@link runCli} which assembles the `\@effect/cli` command tree and
|
|
10
|
-
* executes it via `\@effect/platform-node`.
|
|
11
|
-
*
|
|
6
|
+
* The `savvy` bin. Imports `main` and calls it. Nothing else, ever.
|
|
12
7
|
* @internal
|
|
13
8
|
*/
|
|
14
|
-
/* v8 ignore start --
|
|
15
|
-
|
|
9
|
+
/* v8 ignore start -- bin shim; covered by the silk bins e2e */
|
|
10
|
+
main();
|
|
16
11
|
/* v8 ignore stop */
|
|
17
12
|
|
|
18
13
|
//#endregion
|
package/cli/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { changesetCommand } from "../commands/changeset/index.js";
|
|
2
2
|
import { checkCommand } from "../commands/check.js";
|
|
3
|
-
import { cleanCommand } from "../commands/clean.js";
|
|
4
3
|
import { commitCommand } from "../commands/commit/index.js";
|
|
5
4
|
import { initCommand } from "../commands/init.js";
|
|
6
5
|
import { lintCommand } from "../commands/lint/index.js";
|
|
7
6
|
import { reposCommand } from "../commands/repos/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { cleanCommand } from "../commands/clean.js";
|
|
8
|
+
import { Command } from "effect/unstable/cli";
|
|
9
|
+
import { BiomeSchemaSync, ChangesetConfigReader, Changesets, ConfigDiscovery, Repos, SilkPublishability } from "@savvy-web/silk-effects";
|
|
10
|
+
import { Layer } from "effect";
|
|
10
11
|
import { Git } from "@effected/git";
|
|
11
|
-
import { ManagedSection } from "@effected/templates";
|
|
12
12
|
import { PackageManagerDetector, WorkspaceDiscovery, WorkspaceRoot, Workspaces } from "@effected/workspaces";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { ManagedSection } from "@effected/templates";
|
|
14
|
+
import { ToolDiscovery } from "@effected/commands";
|
|
15
|
+
import { NodeServices } from "@effect/platform-node";
|
|
16
16
|
|
|
17
17
|
//#region src/cli/index.ts
|
|
18
18
|
/**
|
|
@@ -73,11 +73,6 @@ const rootCommand = Command.make("savvy").pipe(Command.withSubcommands([
|
|
|
73
73
|
reposCommand
|
|
74
74
|
]));
|
|
75
75
|
/**
|
|
76
|
-
* CLI application: reads argv from the Stdio service provided by NodeServices.
|
|
77
|
-
* (v4's `Command.run` takes only `version` — the name comes from the root command.)
|
|
78
|
-
*/
|
|
79
|
-
const cli = Command.run(rootCommand, { version: "2.11.4" });
|
|
80
|
-
/**
|
|
81
76
|
* Shared workspace services from `@effected/workspaces`, wired as a
|
|
82
77
|
* self-contained unit and built ONCE (layers memoize by reference).
|
|
83
78
|
* `WorkspaceDiscovery.layer()` is root-bound at first use via `WorkspaceRoot`
|
|
@@ -125,23 +120,14 @@ const ReposGroupLive = Layer.mergeAll(Repos.ReposManager.layer, Repos.ReposDrift
|
|
|
125
120
|
*/
|
|
126
121
|
const LocalExecLive = Workspaces.localExecLayer();
|
|
127
122
|
const ToolDiscoveryGroupLive = ToolDiscovery.layer.pipe(Layer.provide(LocalExecLive), Layer.provide(WorkspaceLive));
|
|
128
|
-
const AppLive = Layer.mergeAll(ToolDiscoveryGroupLive, InspectorAndAnalyzerLive, ReposGroupLive).pipe(Layer.provideMerge(BaseLive), Layer.provideMerge(NodeServices.layer));
|
|
129
123
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* service; the merged layer stack is provided and execution handed to
|
|
135
|
-
* `NodeRuntime.runMain`, whose default reporting covers defects (the v3
|
|
136
|
-
* `Cause.defects` wrapper is gone). No type casts: the layer graph is
|
|
137
|
-
* validated by the compiler.
|
|
138
|
-
*
|
|
139
|
-
* @internal
|
|
124
|
+
* The merged runtime Layer stack satisfying every command's service
|
|
125
|
+
* requirements. Provided to `rootCommand`'s assembled `Command.run` Effect by
|
|
126
|
+
* `main()` in `../main.js`; this module never calls `NodeRuntime.runMain`
|
|
127
|
+
* itself.
|
|
140
128
|
*/
|
|
141
|
-
|
|
142
|
-
NodeRuntime.runMain(cli.pipe(Effect.provide(AppLive)));
|
|
143
|
-
}
|
|
129
|
+
const AppLive = Layer.mergeAll(ToolDiscoveryGroupLive, InspectorAndAnalyzerLive, ReposGroupLive).pipe(Layer.provideMerge(BaseLive), Layer.provideMerge(NodeServices.layer));
|
|
144
130
|
/* v8 ignore stop */
|
|
145
131
|
|
|
146
132
|
//#endregion
|
|
147
|
-
export {
|
|
133
|
+
export { AppLive, rootCommand };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
1
|
import { Argument, Command } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Changesets } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/commands/check.ts
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
1
|
import { Argument, Command } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Changesets } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/commands/config-validate.ts
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Console, Effect, Option } from "effect";
|
|
3
1
|
import { Command, Flag } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Changesets } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Console, Effect, Option } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/commands/deps-detect.ts
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Console, Effect, Option } from "effect";
|
|
3
1
|
import { Command, Flag } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Changesets } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Console, Effect, Option } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/commands/deps-regen.ts
|
|
7
7
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WorkspaceRoot } from "@effected/workspaces";
|
|
1
|
+
import { join } from "node:path";
|
|
3
2
|
import { Changesets } from "@savvy-web/silk-effects";
|
|
4
3
|
import { Data, Effect, Option, Result, Schema } from "effect";
|
|
5
|
-
import { join } from "node:path";
|
|
6
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { Git } from "@effected/git";
|
|
7
6
|
import { Jsonc, JsoncEdit, JsoncModifier } from "@effected/jsonc";
|
|
7
|
+
import { WorkspaceRoot } from "@effected/workspaces";
|
|
8
8
|
|
|
9
9
|
//#region src/commands/changeset/commands/init.ts
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Console, Effect } from "effect";
|
|
3
1
|
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Changesets } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Console, Effect } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/commands/lint.ts
|
|
7
7
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { requireValidConfig } from "../utils/config-gate.js";
|
|
2
|
-
import { Changesets } from "@savvy-web/silk-effects";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
2
|
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
5
3
|
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { Changesets } from "@savvy-web/silk-effects";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
6
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/changeset/commands/transform.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command } from "effect/unstable/cli";
|
|
1
2
|
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/changeset/commands/validate-file.ts
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { requireValidConfig } from "../utils/config-gate.js";
|
|
2
|
+
import { Command, Flag } from "effect/unstable/cli";
|
|
2
3
|
import { Changesets } from "@savvy-web/silk-effects";
|
|
3
4
|
import { Effect } from "effect";
|
|
4
|
-
import { Command, Flag } from "effect/unstable/cli";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/commands/version.ts
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { join, resolve } from "node:path";
|
|
1
2
|
import { Changesets } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/changeset/utils/config-gate.ts
|
package/commands/check.js
CHANGED
|
@@ -2,8 +2,8 @@ import { runChangesetCheck } from "./changeset/commands/check.js";
|
|
|
2
2
|
import "./changeset/index.js";
|
|
3
3
|
import { runCommitCheck } from "./commit/check.js";
|
|
4
4
|
import { runLintCheck } from "./lint/check.js";
|
|
5
|
-
import { Effect, Result } from "effect";
|
|
6
5
|
import { Command, Flag } from "effect/unstable/cli";
|
|
6
|
+
import { Effect, Result } from "effect";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/check.ts
|
|
9
9
|
/**
|
|
@@ -18,7 +18,7 @@ import { Command, Flag } from "effect/unstable/cli";
|
|
|
18
18
|
* regardless of individual failures and then surface the full set of errors.
|
|
19
19
|
*
|
|
20
20
|
* Runtime layer provision (ManagedSection, FileSystem, WorkspaceRoot,
|
|
21
|
-
* ToolDiscovery, etc.) is deferred to Task B7 (root `
|
|
21
|
+
* ToolDiscovery, etc.) is deferred to Task B7 (root `main`). The Effect
|
|
22
22
|
* returned by `checkCommand`'s handler therefore carries the full union of the
|
|
23
23
|
* three handlers' requirements in its R channel.
|
|
24
24
|
*
|
package/commands/clean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
2
|
-
import { Data, Effect } from "effect";
|
|
3
1
|
import { Command, Flag } from "effect/unstable/cli";
|
|
4
2
|
import { join, sep } from "node:path";
|
|
3
|
+
import { Data, Effect } from "effect";
|
|
4
|
+
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
5
5
|
import { glob, realpath, rm } from "node:fs/promises";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/clean.ts
|
package/commands/commit/check.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HUSKY_HOOK_PATH, POST_CHECKOUT_HOOK_PATH, POST_COMMIT_HOOK_PATH, POST_MERGE_HOOK_PATH } from "./constants.js";
|
|
2
2
|
import { SECTION_DEF, savvyCommitBlock } from "./init.js";
|
|
3
|
-
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
4
|
-
import { VersioningStrategy } from "@effected/workspaces";
|
|
5
3
|
import { ChangesetConfigReader, Commitlint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
6
4
|
import { Effect, FileSystem, Option } from "effect";
|
|
5
|
+
import { VersioningStrategy } from "@effected/workspaces";
|
|
6
|
+
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/commit/check.ts
|
|
9
9
|
/** Unicode cross symbol. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildCommitlintInvocation } from "../commitlint-invocation.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Command } from "effect/unstable/cli";
|
|
3
3
|
import { Commitlint } from "@savvy-web/silk-effects";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
import {
|
|
5
|
+
import { Git } from "@effected/git";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { execFile } from "node:child_process";
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Commitlint } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
3
1
|
import { Command } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Commitlint } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Effect, Schema } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/commit/hooks/pre-commit-message.ts
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Commitlint } from "@savvy-web/silk-effects";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
1
|
import { Command } from "effect/unstable/cli";
|
|
4
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { Commitlint } from "@savvy-web/silk-effects";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/commit/hooks/session-start.ts
|
|
7
7
|
/**
|
package/commands/commit/init.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HUSKY_HOOK_PATH, POST_CHECKOUT_HOOK_PATH, POST_COMMIT_HOOK_PATH, POST_MERGE_HOOK_PATH } from "./constants.js";
|
|
2
|
-
import {
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
3
|
import { SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyToolSection, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
4
4
|
import { Effect, FileSystem } from "effect";
|
|
5
|
-
import {
|
|
5
|
+
import { CommentStyle, ManagedSection, SectionId } from "@effected/templates";
|
|
6
6
|
import { chmod } from "node:fs/promises";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/commit/init.ts
|
package/commands/commit/lint.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildCommitlintInvocation } from "./commitlint-invocation.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Argument, CliError, Command } from "effect/unstable/cli";
|
|
3
3
|
import { Commitlint } from "@savvy-web/silk-effects";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
-
import {
|
|
5
|
+
import { Git } from "@effected/git";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { execFile } from "node:child_process";
|
|
8
8
|
|
package/commands/init.js
CHANGED
|
@@ -2,8 +2,8 @@ import { runChangesetInit } from "./changeset/commands/init.js";
|
|
|
2
2
|
import "./changeset/index.js";
|
|
3
3
|
import { runCommitInit } from "./commit/init.js";
|
|
4
4
|
import { runLintInit } from "./lint/init.js";
|
|
5
|
-
import { Effect } from "effect";
|
|
6
5
|
import { Command, Flag } from "effect/unstable/cli";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/init.ts
|
|
9
9
|
/**
|
|
@@ -15,7 +15,7 @@ import { Command, Flag } from "effect/unstable/cli";
|
|
|
15
15
|
* are injected so the orchestration logic is unit-testable in isolation.
|
|
16
16
|
*
|
|
17
17
|
* Runtime layer provision (ManagedSection, FileSystem, WorkspaceRoot,
|
|
18
|
-
* BiomeSchemaSync, etc.) is deferred to Task B7 (root `
|
|
18
|
+
* BiomeSchemaSync, etc.) is deferred to Task B7 (root `main`). The Effect
|
|
19
19
|
* returned by `initCommand`'s handler therefore carries the full union of the
|
|
20
20
|
* three handlers' requirements in its R channel.
|
|
21
21
|
*
|
package/commands/lint/check.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BIOME_VERSION } from "./biome-version.js";
|
|
2
|
-
import { Tool, ToolDiscovery } from "@effected/commands";
|
|
3
|
-
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
4
2
|
import { ConfigDiscovery, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
5
3
|
import { Effect, FileSystem, Option } from "effect";
|
|
6
4
|
import { Jsonc } from "@effected/jsonc";
|
|
5
|
+
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
7
6
|
import { isDeepStrictEqual } from "node:util";
|
|
7
|
+
import { Tool, ToolDiscovery } from "@effected/commands";
|
|
8
8
|
|
|
9
9
|
//#region src/commands/lint/check.ts
|
|
10
10
|
/**
|
|
@@ -53,6 +53,10 @@ function findConfigFile(fs) {
|
|
|
53
53
|
/**
|
|
54
54
|
* Find the first existing config file from a list of candidates using ConfigDiscovery.
|
|
55
55
|
*
|
|
56
|
+
* The engine takes no ambient cwd; this CLI front end owns the process, so the
|
|
57
|
+
* discovery root is the process cwd the rest of `lint check` already resolves
|
|
58
|
+
* its relative paths against.
|
|
59
|
+
*
|
|
56
60
|
* @param discovery - ConfigDiscovery service
|
|
57
61
|
* @param names - Config file names to search for (in priority order)
|
|
58
62
|
* @returns The config file path or null
|
|
@@ -60,7 +64,7 @@ function findConfigFile(fs) {
|
|
|
60
64
|
function findConfig(discovery, names) {
|
|
61
65
|
return Effect.gen(function* () {
|
|
62
66
|
for (const name of names) {
|
|
63
|
-
const result = yield* discovery.find(name);
|
|
67
|
+
const result = yield* discovery.find(name, { cwd: process.cwd() });
|
|
64
68
|
if (result) return result.path;
|
|
65
69
|
}
|
|
66
70
|
return null;
|
package/commands/lint/fmt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Lint } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect, Option } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { Yaml } from "@effected/yaml";
|
|
6
6
|
|
package/commands/lint/init.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BIOME_VERSION } from "./biome-version.js";
|
|
2
|
-
import {
|
|
3
|
-
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
4
3
|
import { BiomeSchemaSync, LIFECYCLE_SCRIPTS_CONFIG_KEY, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, publishesBuiltLinkDirectory, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
5
4
|
import { Effect, FileSystem } from "effect";
|
|
6
|
-
import { dirname, join } from "node:path";
|
|
7
5
|
import { Jsonc, JsoncEdit, JsoncModifier } from "@effected/jsonc";
|
|
6
|
+
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
7
|
+
import { ManagedSection } from "@effected/templates";
|
|
8
8
|
import { chmod } from "node:fs/promises";
|
|
9
9
|
import { isDeepStrictEqual } from "node:util";
|
|
10
10
|
|
|
@@ -138,10 +138,10 @@ function writeMarkdownlintConfig(fs, preset, force) {
|
|
|
138
138
|
* needed on the happy path.
|
|
139
139
|
*
|
|
140
140
|
* Discovery failing yields an EMPTY list, which the caller reads as "no roots
|
|
141
|
-
* to enumerate — scan
|
|
142
|
-
*
|
|
143
|
-
* and an ambient `process.cwd()` read in this function would be a
|
|
144
|
-
* divergent source of truth for the same directory.
|
|
141
|
+
* to enumerate — scan the process cwd instead". The cwd is deliberately not
|
|
142
|
+
* named here: `syncBiomeSchemas` resolves it exactly once for the fallback
|
|
143
|
+
* pass, and an ambient `process.cwd()` read in this function would be a
|
|
144
|
+
* second, divergent source of truth for the same directory.
|
|
145
145
|
*
|
|
146
146
|
* The two ways discovery fails mean different things and are reported differently:
|
|
147
147
|
*
|
|
@@ -212,7 +212,7 @@ function syncBiomeSchemas() {
|
|
|
212
212
|
return Effect.gen(function* () {
|
|
213
213
|
const syncer = yield* BiomeSchemaSync;
|
|
214
214
|
const roots = yield* biomeConfigRoots();
|
|
215
|
-
const passes = roots.length > 0 ? roots.map((cwd) => ({ cwd })) : [
|
|
215
|
+
const passes = roots.length > 0 ? roots.map((cwd) => ({ cwd })) : [{ cwd: process.cwd() }];
|
|
216
216
|
for (const options of passes) yield* syncer.sync(BIOME_VERSION, options).pipe(Effect.flatMap((result) => Effect.gen(function* () {
|
|
217
217
|
for (const configPath of result.current) yield* Effect.log(`${CHECK_MARK} ${configPath}: biome $schema up-to-date`);
|
|
218
218
|
for (const configPath of result.updated) yield* Effect.log(`${CHECK_MARK} Updated $schema in ${configPath}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect, Option } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/add.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/deregister.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/note.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/pin.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/remove.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/rename.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
1
2
|
import { Repos } from "@savvy-web/silk-effects";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/repos/commands/restore.ts
|
|
6
6
|
/**
|
package/index.d.ts
CHANGED
|
@@ -8,65 +8,6 @@ import { ManagedSection, SectionFileError, SectionParseError, SectionRenderError
|
|
|
8
8
|
import { PlatformError } from "effect/PlatformError";
|
|
9
9
|
import { ToolDiscovery } from "@effected/commands";
|
|
10
10
|
import { JsoncParseError } from "@effected/jsonc";
|
|
11
|
-
//#region src/cli/index.d.ts
|
|
12
|
-
/**
|
|
13
|
-
* Root `savvy` CLI entry point using `effect/unstable/cli`.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Assembles the five Phase-B command pieces — the `init` and `check` top-level
|
|
17
|
-
* orchestrators plus the `changeset`, `commit`, and `lint` groups — under a
|
|
18
|
-
* single `savvy` root command, then provides the merged runtime Layer stack
|
|
19
|
-
* that satisfies every command's service requirements.
|
|
20
|
-
*
|
|
21
|
-
* The layer stack wires the silk-effects service layers over their v4
|
|
22
|
-
* requirement channels:
|
|
23
|
-
*
|
|
24
|
-
* - `NodeServices.layer` — `FileSystem`, `Path`, `ChildProcessSpawner`, `Stdio`,
|
|
25
|
-
* and `Terminal`, consumed by every config reader, workspace service, git
|
|
26
|
-
* layer, and the CLI framework itself.
|
|
27
|
-
* - `Git.layer` (from `@effected/git`) — the typed git service backing
|
|
28
|
-
* `BranchAnalyzer`, `ReposManager`, the commit hooks
|
|
29
|
-
* (`readBranchInfo` / `readSigningDiagnostic`), and `detectGitHubRepo`.
|
|
30
|
-
* - Workspace services from `@effected/workspaces` — `WorkspaceRoot.layer`,
|
|
31
|
-
* `PackageManagerDetector.layer`, and a single root-bound
|
|
32
|
-
* `WorkspaceDiscovery.layer()` (the kit resolves the root through
|
|
33
|
-
* `WorkspaceRoot` from `process.cwd()` lazily on first use, so the CLI's
|
|
34
|
-
* startup cwd is the discovery root).
|
|
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
|
-
* `ToolDiscovery.layer` over `ChildProcessSpawner` plus a `LocalExec`, which
|
|
40
|
-
* `Workspaces.localExecLayer()` supplies from the detected package manager.
|
|
41
|
-
* Versioning classification
|
|
42
|
-
* is a pure `@effected/workspaces` value operation over `WorkspaceDiscovery`
|
|
43
|
-
* and the silk `PublishabilityDetector`, so it needs no layer of its own.
|
|
44
|
-
* - Changesets-namespace services — `Changesets.ConfigInspector.layer`,
|
|
45
|
-
* `Changesets.ReleasePlanner.layer`, and `Changesets.BranchAnalyzer.layer`
|
|
46
|
-
* sharing a single `ConfigInspector` via `provideMerge`. `DepsRegen` is NOT
|
|
47
|
-
* part of AppLive: its graph is root-bound at layer build, so the deps
|
|
48
|
-
* commands compose `Changesets.makeDepsRegenDefault({ cwd })` per invocation
|
|
49
|
-
* against their parsed `--cwd` (platform services flow up to
|
|
50
|
-
* `NodeServices.layer` here).
|
|
51
|
-
*
|
|
52
|
-
* The CLI version is injected at build time via `process.env.__PACKAGE_VERSION__`.
|
|
53
|
-
*
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
/**
|
|
57
|
-
* Bootstrap and run the `savvy` CLI application.
|
|
58
|
-
*
|
|
59
|
-
* @remarks
|
|
60
|
-
* `Command.run` returns an Effect reading `process.argv` from the Stdio
|
|
61
|
-
* service; the merged layer stack is provided and execution handed to
|
|
62
|
-
* `NodeRuntime.runMain`, whose default reporting covers defects (the v3
|
|
63
|
-
* `Cause.defects` wrapper is gone). No type casts: the layer graph is
|
|
64
|
-
* validated by the compiler.
|
|
65
|
-
*
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
export declare function runCli(): void;
|
|
69
|
-
//#endregion
|
|
70
11
|
//#region src/commands/changeset/commands/check.d.ts
|
|
71
12
|
/**
|
|
72
13
|
* Run the check validation pipeline on all changeset files in `dir`.
|
package/index.js
CHANGED
|
@@ -12,6 +12,5 @@ import { lintCommand } from "./commands/lint/index.js";
|
|
|
12
12
|
import { runReposStatus } from "./commands/repos/commands/status.js";
|
|
13
13
|
import { runReposSync } from "./commands/repos/commands/sync.js";
|
|
14
14
|
import { reposCommand } from "./commands/repos/index.js";
|
|
15
|
-
import { runCli } from "./cli/index.js";
|
|
16
15
|
|
|
17
|
-
export { changesetCommand, checkCommand, commitCommand, initCommand, lintCommand, reposCommand, runChangesetCheck, runChangesetInit, runCheck,
|
|
16
|
+
export { changesetCommand, checkCommand, commitCommand, initCommand, lintCommand, reposCommand, runChangesetCheck, runChangesetInit, runCheck, runCommitCheck, runCommitInit, runInit, runLintCheck, runLintInit, runReposStatus, runReposSync };
|
package/main.d.ts
ADDED
package/main.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AppLive, rootCommand } from "./cli/index.js";
|
|
2
|
+
import { Command } from "effect/unstable/cli";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { NodeRuntime } from "@effect/platform-node";
|
|
5
|
+
|
|
6
|
+
//#region src/main.ts
|
|
7
|
+
/**
|
|
8
|
+
* Owns the process. `index.ts` must stay importable without side effects;
|
|
9
|
+
* never import this module from the barrel.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Assembles the `Command.run` Effect over `rootCommand`, provides the merged
|
|
13
|
+
* `AppLive` runtime layer stack from `./cli/index.js`, and hands execution to
|
|
14
|
+
* `NodeRuntime.runMain`, whose default reporting covers defects (the v3
|
|
15
|
+
* `Cause.defects` wrapper is gone). No type casts: the layer graph is
|
|
16
|
+
* validated by the compiler.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
/* v8 ignore start -- bootstrap; commands tested individually */
|
|
21
|
+
/**
|
|
22
|
+
* CLI application: reads argv from the Stdio service provided by NodeServices.
|
|
23
|
+
* (v4's `Command.run` takes only `version` — the name comes from the root command.)
|
|
24
|
+
*/
|
|
25
|
+
const cli = Command.run(rootCommand, { version: "3.0.1" });
|
|
26
|
+
/**
|
|
27
|
+
* Bootstrap and run the `savvy` CLI application.
|
|
28
|
+
*/
|
|
29
|
+
const main = () => {
|
|
30
|
+
NodeRuntime.runMain(cli.pipe(Effect.provide(AppLive)));
|
|
31
|
+
};
|
|
32
|
+
/* v8 ignore stop */
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { main };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
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",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"import": "./index.js",
|
|
26
26
|
"default": "./index.js"
|
|
27
27
|
},
|
|
28
|
+
"./main": {
|
|
29
|
+
"types": "./main.d.ts",
|
|
30
|
+
"import": "./main.js",
|
|
31
|
+
"default": "./main.js"
|
|
32
|
+
},
|
|
28
33
|
"./package.json": "./package.json"
|
|
29
34
|
},
|
|
30
35
|
"bin": {
|
|
@@ -33,12 +38,12 @@
|
|
|
33
38
|
"dependencies": {
|
|
34
39
|
"@effect/platform-node": "4.0.0-rc.115",
|
|
35
40
|
"@effected/commands": "^0.7.0",
|
|
36
|
-
"@effected/git": "^0.15.
|
|
41
|
+
"@effected/git": "^0.15.1",
|
|
37
42
|
"@effected/jsonc": "^0.11.0",
|
|
38
43
|
"@effected/templates": "^0.6.0",
|
|
39
|
-
"@effected/workspaces": "^0.21.
|
|
40
|
-
"@effected/yaml": "^0.15.
|
|
41
|
-
"@savvy-web/silk-effects": "
|
|
44
|
+
"@effected/workspaces": "^0.21.1",
|
|
45
|
+
"@effected/yaml": "^0.15.1",
|
|
46
|
+
"@savvy-web/silk-effects": "8.0.1",
|
|
42
47
|
"effect": "4.0.0-rc.115"
|
|
43
48
|
}
|
|
44
49
|
}
|