@savvy-web/cli 3.0.5 → 3.2.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/commands/lint/biome-version.js +1 -1
- package/commands/lint/check.js +13 -2
- package/commands/lint/init.js +7 -7
- package/main.js +1 -1
- package/package.json +2 -2
package/commands/lint/check.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BIOME_VERSION } from "./biome-version.js";
|
|
2
|
-
import { ConfigDiscovery, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
2
|
+
import { ConfigDiscovery, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyOkfBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
3
3
|
import { Effect, FileSystem, Option } from "effect";
|
|
4
4
|
import { Jsonc } from "@effected/jsonc";
|
|
5
5
|
import { CheckOutcome, ManagedSection } from "@effected/templates";
|
|
@@ -160,6 +160,7 @@ function runLintCheck(opts) {
|
|
|
160
160
|
let sectionsHealthy = true;
|
|
161
161
|
let baseStatusLabel = "missing";
|
|
162
162
|
let lintStatusLabel = "missing";
|
|
163
|
+
let okfStatusLabel = "missing";
|
|
163
164
|
let detectedConfigPath = null;
|
|
164
165
|
if (hasHuskyHook) {
|
|
165
166
|
const baseResult = yield* ms.check(Lint.HUSKY_HOOK_PATH, SavvyBaseSection.section(savvyBasePreamble()));
|
|
@@ -188,7 +189,14 @@ function runLintCheck(opts) {
|
|
|
188
189
|
sectionsHealthy = false;
|
|
189
190
|
}
|
|
190
191
|
} else sectionsHealthy = false;
|
|
191
|
-
|
|
192
|
+
const okfResult = yield* ms.check(Lint.HUSKY_HOOK_PATH, savvyOkfBlock());
|
|
193
|
+
if (CheckOutcome.$is("Absent")(okfResult)) sectionsHealthy = false;
|
|
194
|
+
else {
|
|
195
|
+
const upToDate = CheckOutcome.$is("UpToDate")(okfResult);
|
|
196
|
+
okfStatusLabel = upToDate ? "up-to-date" : "outdated";
|
|
197
|
+
if (!upToDate) sectionsHealthy = false;
|
|
198
|
+
}
|
|
199
|
+
if (baseStatusLabel !== "up-to-date" || lintStatusLabel !== "up-to-date" || okfStatusLabel !== "up-to-date") warnings.push(`${WARNING} Your ${Lint.HUSKY_HOOK_PATH} managed sections are out of date.\n Run 'savvy init' to update (preserves your custom hooks).`);
|
|
192
200
|
} else {
|
|
193
201
|
sectionsHealthy = false;
|
|
194
202
|
warnings.push(`${WARNING} No husky pre-commit hook found.\n Run 'savvy init' to create it.`);
|
|
@@ -293,6 +301,9 @@ function runLintCheck(opts) {
|
|
|
293
301
|
if (lintStatusLabel === "up-to-date") yield* Effect.log(`${CHECK_MARK} Lint section: up-to-date${lintLabel}`);
|
|
294
302
|
else if (lintStatusLabel === "outdated") yield* Effect.log(`${WARNING} Lint section: outdated (run 'savvy init' to update)`);
|
|
295
303
|
else yield* Effect.log(`${BULLET} Lint section: not found (run 'savvy init' to add)`);
|
|
304
|
+
if (okfStatusLabel === "up-to-date") yield* Effect.log(`${CHECK_MARK} OKF section: up-to-date`);
|
|
305
|
+
else if (okfStatusLabel === "outdated") yield* Effect.log(`${WARNING} OKF section: outdated (run 'savvy init' to update)`);
|
|
306
|
+
else yield* Effect.log(`${BULLET} OKF section: not found (run 'savvy init' to add)`);
|
|
296
307
|
}
|
|
297
308
|
for (const status of shellHookStatuses) if (!status.found) yield* Effect.log(`${BULLET} ${status.path}: savvy-hooks section not found`);
|
|
298
309
|
else if (status.isUpToDate) yield* Effect.log(`${CHECK_MARK} ${status.path}: up-to-date`);
|
package/commands/lint/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BIOME_VERSION } from "./biome-version.js";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
|
-
import { BiomeSchemaSync, LIFECYCLE_SCRIPTS_CONFIG_KEY, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, publishesBuiltLinkDirectory, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
3
|
+
import { BiomeSchemaSync, LIFECYCLE_SCRIPTS_CONFIG_KEY, Lint, SavvyBaseSection, SavvyHooksSection, SavvyToolchainSection, publishesBuiltLinkDirectory, savvyBasePreamble, savvyHooksHygiene, savvyInstallBlock, savvyOkfBlock, savvyToolchainCheck } from "@savvy-web/silk-effects";
|
|
4
4
|
import { Effect, FileSystem } from "effect";
|
|
5
5
|
import { Jsonc, JsoncEdit, JsoncModifier } from "@effected/jsonc";
|
|
6
6
|
import { WorkspaceDiscovery } from "@effected/workspaces";
|
|
@@ -65,11 +65,7 @@ function presetIncludesMarkdown(preset) {
|
|
|
65
65
|
* @returns Config file content
|
|
66
66
|
*/
|
|
67
67
|
function generateConfigContent(preset) {
|
|
68
|
-
return
|
|
69
|
-
* lint-staged configuration
|
|
70
|
-
* Generated by savvy lint init
|
|
71
|
-
*/
|
|
72
|
-
import { Preset } from "@savvy-web/silk/lint";
|
|
68
|
+
return `import { Preset } from "@savvy-web/silk/lint";
|
|
73
69
|
|
|
74
70
|
export default Preset.${preset}();
|
|
75
71
|
`;
|
|
@@ -254,7 +250,11 @@ function runLintInit(opts) {
|
|
|
254
250
|
yield* fs.makeDirectory(".husky", { recursive: true });
|
|
255
251
|
if (force) yield* fs.writeFileString(Lint.HUSKY_HOOK_PATH, PRE_COMMIT_HEADER);
|
|
256
252
|
else yield* ensureHookFile(Lint.HUSKY_HOOK_PATH, PRE_COMMIT_HEADER);
|
|
257
|
-
const preCommitResults = yield* ms.syncAll(Lint.HUSKY_HOOK_PATH, [
|
|
253
|
+
const preCommitResults = yield* ms.syncAll(Lint.HUSKY_HOOK_PATH, [
|
|
254
|
+
SavvyBaseSection.section(savvyBasePreamble()),
|
|
255
|
+
Lint.savvyLintBlock(config),
|
|
256
|
+
savvyOkfBlock()
|
|
257
|
+
]);
|
|
258
258
|
yield* makeExecutable(Lint.HUSKY_HOOK_PATH);
|
|
259
259
|
yield* Effect.log(`${CHECK_MARK} ${force ? "Replaced" : "Synced"} ${Lint.HUSKY_HOOK_PATH} (${preCommitResults.map((r) => r._tag).join(", ")})`);
|
|
260
260
|
if (presetIncludesShellScripts(preset)) for (const [hookPath, installHook] of HYGIENE_HOOKS) {
|
package/main.js
CHANGED
|
@@ -22,7 +22,7 @@ import { NodeRuntime } from "@effect/platform-node";
|
|
|
22
22
|
* CLI application: reads argv from the Stdio service provided by NodeServices.
|
|
23
23
|
* (v4's `Command.run` takes only `version` — the name comes from the root command.)
|
|
24
24
|
*/
|
|
25
|
-
const cli = Command.run(rootCommand, { version: "3.0
|
|
25
|
+
const cli = Command.run(rootCommand, { version: "3.2.0" });
|
|
26
26
|
/**
|
|
27
27
|
* Bootstrap and run the `savvy` CLI application.
|
|
28
28
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/cli",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@effected/templates": "^0.6.0",
|
|
44
44
|
"@effected/workspaces": "^0.22.0",
|
|
45
45
|
"@effected/yaml": "^0.15.1",
|
|
46
|
-
"@savvy-web/silk-effects": "8.0
|
|
46
|
+
"@savvy-web/silk-effects": "8.2.0",
|
|
47
47
|
"effect": "4.0.0-rc.115"
|
|
48
48
|
}
|
|
49
49
|
}
|