@savvy-web/cli 2.8.2 → 2.9.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 +1 -1
- package/commands/commit/check.js +11 -1
- package/commands/commit/init.js +4 -2
- package/commands/lint/biome-version.js +1 -1
- package/commands/lint/check.js +21 -1
- package/commands/lint/init.js +4 -2
- package/package.json +2 -2
package/cli/index.js
CHANGED
|
@@ -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.
|
|
79
|
+
const cli = Command.run(rootCommand, { version: "2.9.0" });
|
|
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).
|
package/commands/commit/check.js
CHANGED
|
@@ -2,7 +2,7 @@ import { HUSKY_HOOK_PATH, POST_CHECKOUT_HOOK_PATH, POST_COMMIT_HOOK_PATH, POST_M
|
|
|
2
2
|
import { SECTION_DEF, savvyCommitBlock } from "./init.js";
|
|
3
3
|
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
4
4
|
import { VersioningStrategy } from "@effected/workspaces";
|
|
5
|
-
import { ChangesetConfigReader, Commitlint, SavvyBaseSection, SavvyHooksSection, savvyBasePreamble, savvyHooksHygiene } from "@savvy-web/silk-effects";
|
|
5
|
+
import { ChangesetConfigReader, Commitlint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
6
6
|
import { Effect, FileSystem, Option } from "effect";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/commit/check.ts
|
|
@@ -154,6 +154,16 @@ function runCommitCheck() {
|
|
|
154
154
|
sectionsHealthy = false;
|
|
155
155
|
yield* Effect.log(`${BULLET} Hygiene hook: ${hookPath} section not found (run 'savvy init' to add)`);
|
|
156
156
|
}
|
|
157
|
+
if (hookPath === ".husky/post-commit") continue;
|
|
158
|
+
const toolchainStatus = yield* ms.check(hookPath, SavvyToolchainSection.section(savvyToolchainCheck()));
|
|
159
|
+
if (CheckOutcome.$is("UpToDate")(toolchainStatus)) yield* Effect.log(`${"✓"} Toolchain check: ${hookPath}`);
|
|
160
|
+
else if (CheckOutcome.$is("Drifted")(toolchainStatus)) {
|
|
161
|
+
sectionsHealthy = false;
|
|
162
|
+
yield* Effect.log(`${"⚠"} Toolchain check: ${hookPath} outdated (run 'savvy init' to update)`);
|
|
163
|
+
} else {
|
|
164
|
+
sectionsHealthy = false;
|
|
165
|
+
yield* Effect.log(`${BULLET} Toolchain check: ${hookPath} section not found (run 'savvy init' to add)`);
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
168
|
if (yield* fs.exists(DCO_FILE_PATH)) yield* Effect.log(`${"✓"} DCO file: ${DCO_FILE_PATH}`);
|
|
159
169
|
else yield* Effect.log(`${BULLET} No DCO file (signoff not required)`);
|
package/commands/commit/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HUSKY_HOOK_PATH, POST_CHECKOUT_HOOK_PATH, POST_COMMIT_HOOK_PATH, POST_MERGE_HOOK_PATH } from "./constants.js";
|
|
2
2
|
import { CommentStyle, ManagedSection, SectionId } from "@effected/templates";
|
|
3
|
-
import { SavvyBaseSection, SavvyHooksSection, savvyBasePreamble, savvyHooksHygiene, savvyToolSection } from "@savvy-web/silk-effects";
|
|
3
|
+
import { SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyToolSection, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
4
4
|
import { Effect, FileSystem } from "effect";
|
|
5
5
|
import { dirname } from "node:path";
|
|
6
6
|
import { chmod } from "node:fs/promises";
|
|
@@ -91,7 +91,9 @@ function runCommitInit(opts) {
|
|
|
91
91
|
POST_COMMIT_HOOK_PATH
|
|
92
92
|
]) {
|
|
93
93
|
yield* ensureHookFile(hookPath, HYGIENE_HEADER);
|
|
94
|
-
|
|
94
|
+
const sections = [SavvyHooksSection.section(savvyHooksHygiene())];
|
|
95
|
+
if (hookPath !== ".husky/post-commit") sections.push(SavvyToolchainSection.section(savvyToolchainCheck()));
|
|
96
|
+
yield* ms.syncAll(hookPath, sections);
|
|
95
97
|
yield* makeExecutable(hookPath);
|
|
96
98
|
yield* Effect.log(`${"✓"} Synced ${hookPath}`);
|
|
97
99
|
}
|
package/commands/lint/check.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BIOME_VERSION } from "./biome-version.js";
|
|
2
2
|
import { Tool, ToolDiscovery } from "@effected/commands";
|
|
3
3
|
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
4
|
-
import { ConfigDiscovery, Lint, SavvyBaseSection, SavvyHooksSection, savvyBasePreamble, savvyHooksHygiene } from "@savvy-web/silk-effects";
|
|
4
|
+
import { ConfigDiscovery, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
5
5
|
import { Effect, FileSystem, Option } from "effect";
|
|
6
6
|
import { Jsonc } from "@effected/jsonc";
|
|
7
7
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -196,6 +196,7 @@ function runLintCheck(opts) {
|
|
|
196
196
|
Lint.POST_COMMIT_HOOK_PATH
|
|
197
197
|
];
|
|
198
198
|
const shellHookStatuses = [];
|
|
199
|
+
const toolchainStatuses = [];
|
|
199
200
|
for (const hookPath of shellHookPaths) {
|
|
200
201
|
if (!(yield* fs.exists(hookPath))) {
|
|
201
202
|
shellHookStatuses.push({
|
|
@@ -220,6 +221,22 @@ function runLintCheck(opts) {
|
|
|
220
221
|
sectionsHealthy = false;
|
|
221
222
|
warnings.push(`${WARNING} ${hookPath} savvy-hooks section is outdated.\n Run 'savvy init' to update.`);
|
|
222
223
|
}
|
|
224
|
+
if (hookPath === Lint.POST_COMMIT_HOOK_PATH) continue;
|
|
225
|
+
const toolchainResult = yield* ms.check(hookPath, SavvyToolchainSection.section(savvyToolchainCheck()));
|
|
226
|
+
const toolchainFound = !CheckOutcome.$is("Absent")(toolchainResult);
|
|
227
|
+
const toolchainUpToDate = CheckOutcome.$is("UpToDate")(toolchainResult);
|
|
228
|
+
toolchainStatuses.push({
|
|
229
|
+
path: hookPath,
|
|
230
|
+
found: toolchainFound,
|
|
231
|
+
isUpToDate: toolchainUpToDate
|
|
232
|
+
});
|
|
233
|
+
if (!toolchainFound) {
|
|
234
|
+
sectionsHealthy = false;
|
|
235
|
+
warnings.push(`${WARNING} ${hookPath} has no savvy-toolchain section.\n Run 'savvy init' to add it.`);
|
|
236
|
+
} else if (!toolchainUpToDate) {
|
|
237
|
+
sectionsHealthy = false;
|
|
238
|
+
warnings.push(`${WARNING} ${hookPath} savvy-toolchain section is outdated.\n Run 'savvy init' to update.`);
|
|
239
|
+
}
|
|
223
240
|
}
|
|
224
241
|
const biomeSchemaStatus = yield* checkBiomeSchemas().pipe(Effect.catch(() => Effect.succeed({
|
|
225
242
|
statuses: [],
|
|
@@ -259,6 +276,9 @@ function runLintCheck(opts) {
|
|
|
259
276
|
for (const status of shellHookStatuses) if (!status.found) yield* Effect.log(`${BULLET} ${status.path}: savvy-hooks section not found`);
|
|
260
277
|
else if (status.isUpToDate) yield* Effect.log(`${CHECK_MARK} ${status.path}: up-to-date`);
|
|
261
278
|
else yield* Effect.log(`${WARNING} ${status.path}: outdated (run 'savvy init' to update)`);
|
|
279
|
+
for (const status of toolchainStatuses) if (!status.found) yield* Effect.log(`${BULLET} ${status.path}: savvy-toolchain section not found`);
|
|
280
|
+
else if (status.isUpToDate) yield* Effect.log(`${CHECK_MARK} ${status.path}: savvy-toolchain up-to-date`);
|
|
281
|
+
else yield* Effect.log(`${WARNING} ${status.path}: savvy-toolchain outdated (run 'savvy init' to update)`);
|
|
262
282
|
yield* Effect.log("\nTool availability:");
|
|
263
283
|
const biomeAvailable = yield* td.isAvailable(Tool.named("biome"));
|
|
264
284
|
const biomeConfig = yield* findConfig(discovery, ["biome.jsonc", "biome.json"]);
|
package/commands/lint/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BIOME_VERSION } from "./biome-version.js";
|
|
2
2
|
import { ManagedSection } from "@effected/templates";
|
|
3
3
|
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
4
|
-
import { BiomeSchemaSync, Lint, SavvyBaseSection, SavvyHooksSection, savvyBasePreamble, savvyHooksHygiene } from "@savvy-web/silk-effects";
|
|
4
|
+
import { BiomeSchemaSync, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
5
5
|
import { Effect, FileSystem } from "effect";
|
|
6
6
|
import { dirname } from "node:path";
|
|
7
7
|
import { Jsonc, JsoncEdit, JsoncModifier } from "@effected/jsonc";
|
|
@@ -221,7 +221,9 @@ function runLintInit(opts) {
|
|
|
221
221
|
]) {
|
|
222
222
|
yield* ensureHookFile(hookPath, HYGIENE_HEADER);
|
|
223
223
|
yield* ms.remove(hookPath, Lint.LegacySavvyLintHygieneDef);
|
|
224
|
-
|
|
224
|
+
const sections = [SavvyHooksSection.section(savvyHooksHygiene())];
|
|
225
|
+
if (hookPath !== Lint.POST_COMMIT_HOOK_PATH) sections.push(SavvyToolchainSection.section(savvyToolchainCheck()));
|
|
226
|
+
yield* ms.syncAll(hookPath, sections);
|
|
225
227
|
yield* makeExecutable(hookPath);
|
|
226
228
|
yield* Effect.log(`${CHECK_MARK} Synced ${hookPath}`);
|
|
227
229
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@effected/templates": "^0.4.0",
|
|
39
39
|
"@effected/workspaces": "^0.18.3",
|
|
40
40
|
"@effected/yaml": "^0.12.0",
|
|
41
|
-
"@savvy-web/silk-effects": "7.
|
|
41
|
+
"@savvy-web/silk-effects": "7.3.0",
|
|
42
42
|
"effect": "4.0.0-rc.109"
|
|
43
43
|
}
|
|
44
44
|
}
|