@eslint-config-snapshot/cli 0.6.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @eslint-config-snapshot/cli
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Release minor version with improved human-readable CLI runtime logs and consistent output spacing.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @eslint-config-snapshot/api@0.8.0
13
+
14
+ ## 0.7.0
15
+
16
+ ### Minor Changes
17
+
18
+ - Release minor version after improving runtime command header messaging and UX consistency.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies
23
+ - @eslint-config-snapshot/api@0.7.0
24
+
3
25
  ## 0.6.0
4
26
 
5
27
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -218,13 +218,13 @@ async function executeCheck(cwd, format, defaultInvocation = false) {
218
218
  if (storedSnapshots.size === 0) {
219
219
  const summary = summarizeSnapshots(currentSnapshots);
220
220
  process.stdout.write(
221
- `Current rule state: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).
221
+ `Rules found in this analysis: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).
222
222
  `
223
223
  );
224
224
  const canPromptBaseline = defaultInvocation || format === "summary";
225
225
  if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
226
226
  const shouldCreateBaseline = await askYesNo(
227
- "No baseline yet. Use current rule state as your baseline now? [Y/n] ",
227
+ "No baseline yet. Do you want to save this analyzed rule state as your baseline now? [Y/n] ",
228
228
  true
229
229
  );
230
230
  if (shouldCreateBaseline) {
@@ -329,7 +329,7 @@ async function executeConfig(cwd, format) {
329
329
  const storedSnapshots = await loadStoredSnapshots(cwd);
330
330
  writeRunContextHeader(cwd, `config:${format}`, foundConfig?.path, storedSnapshots);
331
331
  if (shouldShowRunLogs()) {
332
- writeSubtleInfo("\u{1F50E} Resolving effective runtime configuration...\n");
332
+ writeSubtleInfo("\u2699\uFE0F Resolving effective runtime configuration...\n");
333
333
  }
334
334
  const config = await (0, import_api.loadConfig)(cwd);
335
335
  const resolved = await resolveWorkspaceAssignments(cwd, config);
@@ -780,7 +780,6 @@ function printWhatChanged(changes, currentSnapshots, eslintVersionsByGroup) {
780
780
  - workspace membership changes: ${changeSummary.workspace}
781
781
  - current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules
782
782
  - current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off
783
-
784
783
  `
785
784
  );
786
785
  writeEslintVersionSummary(eslintVersionsByGroup);
@@ -890,13 +889,12 @@ function endRunTimer(exitCode) {
890
889
  activeRunTimer.pauseStartedAtMs = void 0;
891
890
  }
892
891
  const elapsedMs = Math.max(0, Date.now() - activeRunTimer.startedAtMs - activeRunTimer.pausedMs);
893
- const color = createColorizer();
894
892
  const seconds = (elapsedMs / 1e3).toFixed(2);
895
893
  if (exitCode === 0) {
896
- writeSubtleInfo(`${color.green("\u2705")} Finished in ${seconds}s
894
+ writeSubtleInfo(`Finished in ${seconds}s
897
895
  `);
898
896
  } else {
899
- writeSubtleInfo(`${color.red("\u274C")} Finished in ${seconds}s
897
+ writeSubtleInfo(`Finished with errors in ${seconds}s
900
898
  `);
901
899
  }
902
900
  activeRunTimer = void 0;
@@ -958,17 +956,53 @@ function writeRunContextHeader(cwd, commandLabel, configPath, storedSnapshots) {
958
956
  return;
959
957
  }
960
958
  const color = createColorizer();
961
- process.stdout.write(color.bold(`\u2728 eslint-config-snapshot v${readCliVersion()}
959
+ process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()} \u2022 ${formatCommandDisplayLabel(commandLabel)}
962
960
  `));
963
- process.stdout.write(`\u{1F9ED} Command: ${commandLabel}
964
- `);
965
961
  process.stdout.write(`\u{1F4C1} Repository: ${cwd}
966
962
  `);
967
- process.stdout.write(`\u2699\uFE0F Config source: ${formatConfigSource(cwd, configPath)}
963
+ process.stdout.write(`\u{1F4C1} Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}
968
964
  `);
969
- process.stdout.write(`\u{1F5C2}\uFE0F Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}
970
-
965
+ process.stdout.write(`\u2699\uFE0F Config source: ${formatConfigSource(cwd, configPath)}
971
966
  `);
967
+ process.stdout.write("\n");
968
+ }
969
+ function formatCommandDisplayLabel(commandLabel) {
970
+ switch (commandLabel) {
971
+ case "check":
972
+ case "check:summary": {
973
+ return "Check drift against baseline (summary)";
974
+ }
975
+ case "check:diff": {
976
+ return "Check drift against baseline (detailed diff)";
977
+ }
978
+ case "check:status": {
979
+ return "Check drift against baseline (status only)";
980
+ }
981
+ case "update": {
982
+ return "Update baseline snapshot";
983
+ }
984
+ case "print:json": {
985
+ return "Print aggregated rules (JSON)";
986
+ }
987
+ case "print:short": {
988
+ return "Print aggregated rules (short view)";
989
+ }
990
+ case "config:json": {
991
+ return "Show effective runtime config (JSON)";
992
+ }
993
+ case "config:short": {
994
+ return "Show effective runtime config (short view)";
995
+ }
996
+ case "init": {
997
+ return "Initialize local configuration";
998
+ }
999
+ case "help": {
1000
+ return "Show CLI help";
1001
+ }
1002
+ default: {
1003
+ return commandLabel;
1004
+ }
1005
+ }
972
1006
  }
973
1007
  function formatConfigSource(cwd, configPath) {
974
1008
  if (!configPath) {
package/dist/index.js CHANGED
@@ -199,13 +199,13 @@ async function executeCheck(cwd, format, defaultInvocation = false) {
199
199
  if (storedSnapshots.size === 0) {
200
200
  const summary = summarizeSnapshots(currentSnapshots);
201
201
  process.stdout.write(
202
- `Current rule state: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).
202
+ `Rules found in this analysis: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).
203
203
  `
204
204
  );
205
205
  const canPromptBaseline = defaultInvocation || format === "summary";
206
206
  if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
207
207
  const shouldCreateBaseline = await askYesNo(
208
- "No baseline yet. Use current rule state as your baseline now? [Y/n] ",
208
+ "No baseline yet. Do you want to save this analyzed rule state as your baseline now? [Y/n] ",
209
209
  true
210
210
  );
211
211
  if (shouldCreateBaseline) {
@@ -310,7 +310,7 @@ async function executeConfig(cwd, format) {
310
310
  const storedSnapshots = await loadStoredSnapshots(cwd);
311
311
  writeRunContextHeader(cwd, `config:${format}`, foundConfig?.path, storedSnapshots);
312
312
  if (shouldShowRunLogs()) {
313
- writeSubtleInfo("\u{1F50E} Resolving effective runtime configuration...\n");
313
+ writeSubtleInfo("\u2699\uFE0F Resolving effective runtime configuration...\n");
314
314
  }
315
315
  const config = await loadConfig(cwd);
316
316
  const resolved = await resolveWorkspaceAssignments(cwd, config);
@@ -761,7 +761,6 @@ function printWhatChanged(changes, currentSnapshots, eslintVersionsByGroup) {
761
761
  - workspace membership changes: ${changeSummary.workspace}
762
762
  - current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules
763
763
  - current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off
764
-
765
764
  `
766
765
  );
767
766
  writeEslintVersionSummary(eslintVersionsByGroup);
@@ -871,13 +870,12 @@ function endRunTimer(exitCode) {
871
870
  activeRunTimer.pauseStartedAtMs = void 0;
872
871
  }
873
872
  const elapsedMs = Math.max(0, Date.now() - activeRunTimer.startedAtMs - activeRunTimer.pausedMs);
874
- const color = createColorizer();
875
873
  const seconds = (elapsedMs / 1e3).toFixed(2);
876
874
  if (exitCode === 0) {
877
- writeSubtleInfo(`${color.green("\u2705")} Finished in ${seconds}s
875
+ writeSubtleInfo(`Finished in ${seconds}s
878
876
  `);
879
877
  } else {
880
- writeSubtleInfo(`${color.red("\u274C")} Finished in ${seconds}s
878
+ writeSubtleInfo(`Finished with errors in ${seconds}s
881
879
  `);
882
880
  }
883
881
  activeRunTimer = void 0;
@@ -939,17 +937,53 @@ function writeRunContextHeader(cwd, commandLabel, configPath, storedSnapshots) {
939
937
  return;
940
938
  }
941
939
  const color = createColorizer();
942
- process.stdout.write(color.bold(`\u2728 eslint-config-snapshot v${readCliVersion()}
940
+ process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()} \u2022 ${formatCommandDisplayLabel(commandLabel)}
943
941
  `));
944
- process.stdout.write(`\u{1F9ED} Command: ${commandLabel}
945
- `);
946
942
  process.stdout.write(`\u{1F4C1} Repository: ${cwd}
947
943
  `);
948
- process.stdout.write(`\u2699\uFE0F Config source: ${formatConfigSource(cwd, configPath)}
944
+ process.stdout.write(`\u{1F4C1} Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}
949
945
  `);
950
- process.stdout.write(`\u{1F5C2}\uFE0F Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}
951
-
946
+ process.stdout.write(`\u2699\uFE0F Config source: ${formatConfigSource(cwd, configPath)}
952
947
  `);
948
+ process.stdout.write("\n");
949
+ }
950
+ function formatCommandDisplayLabel(commandLabel) {
951
+ switch (commandLabel) {
952
+ case "check":
953
+ case "check:summary": {
954
+ return "Check drift against baseline (summary)";
955
+ }
956
+ case "check:diff": {
957
+ return "Check drift against baseline (detailed diff)";
958
+ }
959
+ case "check:status": {
960
+ return "Check drift against baseline (status only)";
961
+ }
962
+ case "update": {
963
+ return "Update baseline snapshot";
964
+ }
965
+ case "print:json": {
966
+ return "Print aggregated rules (JSON)";
967
+ }
968
+ case "print:short": {
969
+ return "Print aggregated rules (short view)";
970
+ }
971
+ case "config:json": {
972
+ return "Show effective runtime config (JSON)";
973
+ }
974
+ case "config:short": {
975
+ return "Show effective runtime config (short view)";
976
+ }
977
+ case "init": {
978
+ return "Initialize local configuration";
979
+ }
980
+ case "help": {
981
+ return "Show CLI help";
982
+ }
983
+ default: {
984
+ return commandLabel;
985
+ }
986
+ }
953
987
  }
954
988
  function formatConfigSource(cwd, configPath) {
955
989
  if (!configPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-config-snapshot/cli",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,6 @@
30
30
  "@inquirer/prompts": "^8.2.0",
31
31
  "commander": "^14.0.3",
32
32
  "fast-glob": "^3.3.3",
33
- "@eslint-config-snapshot/api": "0.6.0"
33
+ "@eslint-config-snapshot/api": "0.8.0"
34
34
  }
35
35
  }
package/src/index.ts CHANGED
@@ -293,18 +293,18 @@ async function executeCheck(cwd: string, format: CheckFormat, defaultInvocation
293
293
 
294
294
  throw error
295
295
  }
296
- if (storedSnapshots.size === 0) {
297
- const summary = summarizeSnapshots(currentSnapshots)
298
- process.stdout.write(
299
- `Current rule state: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).\n`
300
- )
301
-
302
- const canPromptBaseline = defaultInvocation || format === 'summary'
303
- if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
304
- const shouldCreateBaseline = await askYesNo(
305
- 'No baseline yet. Use current rule state as your baseline now? [Y/n] ',
306
- true
296
+ if (storedSnapshots.size === 0) {
297
+ const summary = summarizeSnapshots(currentSnapshots)
298
+ process.stdout.write(
299
+ `Rules found in this analysis: ${summary.groups} groups, ${summary.rules} rules (severity mix: ${summary.error} errors, ${summary.warn} warnings, ${summary.off} off).\n`
307
300
  )
301
+
302
+ const canPromptBaseline = defaultInvocation || format === 'summary'
303
+ if (canPromptBaseline && process.stdin.isTTY && process.stdout.isTTY) {
304
+ const shouldCreateBaseline = await askYesNo(
305
+ 'No baseline yet. Do you want to save this analyzed rule state as your baseline now? [Y/n] ',
306
+ true
307
+ )
308
308
  if (shouldCreateBaseline) {
309
309
  await writeSnapshots(cwd, currentSnapshots)
310
310
  const summary = summarizeSnapshots(currentSnapshots)
@@ -420,7 +420,7 @@ async function executeConfig(cwd: string, format: PrintFormat): Promise<void> {
420
420
  const storedSnapshots = await loadStoredSnapshots(cwd)
421
421
  writeRunContextHeader(cwd, `config:${format}`, foundConfig?.path, storedSnapshots)
422
422
  if (shouldShowRunLogs()) {
423
- writeSubtleInfo('🔎 Resolving effective runtime configuration...\n')
423
+ writeSubtleInfo('⚙️ Resolving effective runtime configuration...\n')
424
424
  }
425
425
  const config = await loadConfig(cwd)
426
426
  const resolved = await resolveWorkspaceAssignments(cwd, config)
@@ -969,7 +969,7 @@ function printWhatChanged(
969
969
  process.stdout.write(color.red('Heads up: snapshot drift detected.\n'))
970
970
  writeSectionTitle('Summary', color)
971
971
  process.stdout.write(
972
- `- changed groups: ${changes.length}\n- introduced rules: ${changeSummary.introduced}\n- removed rules: ${changeSummary.removed}\n- severity changes: ${changeSummary.severity}\n- options changes: ${changeSummary.options}\n- workspace membership changes: ${changeSummary.workspace}\n- current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules\n- current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off\n\n`
972
+ `- changed groups: ${changes.length}\n- introduced rules: ${changeSummary.introduced}\n- removed rules: ${changeSummary.removed}\n- severity changes: ${changeSummary.severity}\n- options changes: ${changeSummary.options}\n- workspace membership changes: ${changeSummary.workspace}\n- current baseline: ${currentSummary.groups} groups, ${currentSummary.rules} rules\n- current severity mix: ${currentSummary.error} errors, ${currentSummary.warn} warnings, ${currentSummary.off} off\n`
973
973
  )
974
974
  writeEslintVersionSummary(eslintVersionsByGroup)
975
975
  process.stdout.write('\n')
@@ -1090,12 +1090,11 @@ function endRunTimer(exitCode: number): void {
1090
1090
  }
1091
1091
 
1092
1092
  const elapsedMs = Math.max(0, Date.now() - activeRunTimer.startedAtMs - activeRunTimer.pausedMs)
1093
- const color = createColorizer()
1094
1093
  const seconds = (elapsedMs / 1000).toFixed(2)
1095
1094
  if (exitCode === 0) {
1096
- writeSubtleInfo(`${color.green('✅')} Finished in ${seconds}s\n`)
1095
+ writeSubtleInfo(`Finished in ${seconds}s\n`)
1097
1096
  } else {
1098
- writeSubtleInfo(`${color.red('❌')} Finished in ${seconds}s\n`)
1097
+ writeSubtleInfo(`Finished with errors in ${seconds}s\n`)
1099
1098
  }
1100
1099
  activeRunTimer = undefined
1101
1100
  }
@@ -1172,11 +1171,50 @@ function writeRunContextHeader(
1172
1171
  }
1173
1172
 
1174
1173
  const color = createColorizer()
1175
- process.stdout.write(color.bold(`✨ eslint-config-snapshot v${readCliVersion()}\n`))
1176
- process.stdout.write(`🧭 Command: ${commandLabel}\n`)
1174
+ process.stdout.write(color.bold(`eslint-config-snapshot v${readCliVersion()} • ${formatCommandDisplayLabel(commandLabel)}\n`))
1177
1175
  process.stdout.write(`📁 Repository: ${cwd}\n`)
1176
+ process.stdout.write(`📁 Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}\n`)
1178
1177
  process.stdout.write(`⚙️ Config source: ${formatConfigSource(cwd, configPath)}\n`)
1179
- process.stdout.write(`🗂️ Baseline: ${formatStoredSnapshotSummary(storedSnapshots)}\n\n`)
1178
+ process.stdout.write('\n')
1179
+ }
1180
+
1181
+ function formatCommandDisplayLabel(commandLabel: string): string {
1182
+ switch (commandLabel) {
1183
+ case 'check':
1184
+ case 'check:summary': {
1185
+ return 'Check drift against baseline (summary)'
1186
+ }
1187
+ case 'check:diff': {
1188
+ return 'Check drift against baseline (detailed diff)'
1189
+ }
1190
+ case 'check:status': {
1191
+ return 'Check drift against baseline (status only)'
1192
+ }
1193
+ case 'update': {
1194
+ return 'Update baseline snapshot'
1195
+ }
1196
+ case 'print:json': {
1197
+ return 'Print aggregated rules (JSON)'
1198
+ }
1199
+ case 'print:short': {
1200
+ return 'Print aggregated rules (short view)'
1201
+ }
1202
+ case 'config:json': {
1203
+ return 'Show effective runtime config (JSON)'
1204
+ }
1205
+ case 'config:short': {
1206
+ return 'Show effective runtime config (short view)'
1207
+ }
1208
+ case 'init': {
1209
+ return 'Initialize local configuration'
1210
+ }
1211
+ case 'help': {
1212
+ return 'Show CLI help'
1213
+ }
1214
+ default: {
1215
+ return commandLabel
1216
+ }
1217
+ }
1180
1218
  }
1181
1219
 
1182
1220
  function formatConfigSource(cwd: string, configPath: string | undefined): string {
@@ -101,7 +101,7 @@ describe('cli terminal invocation', () => {
101
101
  const result = run([])
102
102
  expect(result.status).toBe(1)
103
103
  expect(result.stdout).toBe(
104
- 'Current rule state: 1 groups, 3 rules (severity mix: 2 errors, 0 warnings, 1 off).\nYou are almost set: no baseline snapshot found yet.\nRun `eslint-config-snapshot --update` to create your first baseline.\n'
104
+ 'Rules found in this analysis: 1 groups, 3 rules (severity mix: 2 errors, 0 warnings, 1 off).\nYou are almost set: no baseline snapshot found yet.\nRun `eslint-config-snapshot --update` to create your first baseline.\n'
105
105
  )
106
106
  })
107
107