@alint-js/cli 0.2.0 → 0.3.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.
@@ -1 +1 @@
1
- export { };
1
+ export {}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as executeCli } from "../cli-3Ov9-ZVf.mjs";
2
+ import { t as executeCli } from "../cli-CL433bER.mjs";
3
3
  import process from "node:process";
4
4
  //#region src/bin/index.ts
5
5
  executeCli(process.argv, {
@@ -11,13 +11,13 @@ import { createColors } from "tinyrainbow";
11
11
  import cliSpinners from "cli-spinners";
12
12
  import fastStringWidth from "fast-string-width";
13
13
  import { relative as relative$1 } from "node:path";
14
- import { formatDuration, intervalToDuration } from "date-fns";
15
14
  import fastStringTruncatedWidth from "fast-string-truncated-width";
15
+ import { formatDuration, intervalToDuration } from "date-fns";
16
16
  import Gitignore from "gitignore-fs";
17
17
  import { Minimatch, minimatch } from "minimatch";
18
18
  import { errorMessageFrom as errorMessageFrom$1 } from "@moeru/std";
19
19
  //#region package.json
20
- var version = "0.2.0";
20
+ var version = "0.3.1";
21
21
  //#endregion
22
22
  //#region src/cli/output.ts
23
23
  function escapeLineValue(value) {
@@ -260,8 +260,7 @@ function formatMiniBar(options) {
260
260
  if (width - completeCells === 0) return `[${"█".repeat(width)}]`;
261
261
  if (ratio < animationThreshold) return formatStaticBar(completeCells, width);
262
262
  const frontierIndex = completeCells;
263
- const phase = positiveModulo(options.tick, frontierIndex + 2);
264
- if (phase === frontierIndex + 1) return formatStaticBar(completeCells, width);
263
+ const phase = positiveModulo(options.tick, frontierIndex + 1);
265
264
  return `[${Array.from({ length: width }, (_, index) => {
266
265
  if (phase === 0) {
267
266
  if (index === 0) return "▓";
@@ -969,7 +968,8 @@ async function runPruneModelsCommand(context, options, confirm = confirmPruneMod
969
968
  }
970
969
  if (await confirm() !== "confirmed") return 1;
971
970
  }
972
- await writeSetupConfig(path, applyPlans(config, plans));
971
+ const nextConfig = applyPlans(config, plans);
972
+ await writeSetupConfig(path, nextConfig);
973
973
  return hadFailure ? 2 : 0;
974
974
  }
975
975
  function applyPlans(config, plans) {
@@ -1119,7 +1119,8 @@ async function runRemoveModelCommand(context, request, options) {
1119
1119
  context.io.stderr.write(`cannot remove default model "${escapeLineValue(target.provider.id)}/${escapeLineValue(target.model.id)}". select another default first.\n`);
1120
1120
  return 2;
1121
1121
  }
1122
- await writeSetupConfig(path, removeProviderModels(config, target.provider.id, /* @__PURE__ */ new Set([target.model.id])));
1122
+ const nextConfig = removeProviderModels(config, target.provider.id, /* @__PURE__ */ new Set([target.model.id]));
1123
+ await writeSetupConfig(path, nextConfig);
1123
1124
  context.io.stdout.write(`removed model: ${escapeLineValue(target.provider.id)}/${escapeLineValue(target.model.id)}\nscope: ${scope}\n`);
1124
1125
  return 0;
1125
1126
  }
@@ -1343,7 +1344,8 @@ async function runUnsetProviderCommand(context, key, options) {
1343
1344
  context.io.stderr.write("invalid provider header name. expected an HTTP field-name token.\n");
1344
1345
  return 2;
1345
1346
  }
1346
- await writeSetupConfig(path, unsetProviderHeader(config, providerId, headerName));
1347
+ const nextConfig = unsetProviderHeader(config, providerId, headerName);
1348
+ await writeSetupConfig(path, nextConfig);
1347
1349
  context.io.stdout.write(`provider: ${escapeLineValue(providerId)}\nkey: ${escapeLineValue(key)}\nscope: ${scope}\n`);
1348
1350
  return 0;
1349
1351
  }
@@ -1888,7 +1890,10 @@ async function runNonInteractiveUpdate(context, options, providerEndpoint, exist
1888
1890
  context.io.stderr.write(`failed to probe provider: ${errorMessageFrom(error) ?? "Unknown error."}\n`);
1889
1891
  return 2;
1890
1892
  }
1891
- await writeSetupConfig(path, addProviderModels(addProviderModels(replaceSetupProvider(config, draft), draft.id, remoteModelIds), draft.id, toArray$1(options.providerModel)));
1893
+ const replaced = replaceSetupProvider(config, draft);
1894
+ const withRemoteModels = addProviderModels(replaced, draft.id, remoteModelIds);
1895
+ const nextConfig = addProviderModels(withRemoteModels, draft.id, toArray$1(options.providerModel));
1896
+ await writeSetupConfig(path, nextConfig);
1892
1897
  return 0;
1893
1898
  }
1894
1899
  /**
@@ -1938,7 +1943,8 @@ async function runUpdateProviderCommand(context, options) {
1938
1943
  });
1939
1944
  if (result.status !== "confirmed") return 0;
1940
1945
  const replaced = replaceSetupProvider(config, result.provider);
1941
- await writeSetupConfig(path, result.defaultAliasTarget === void 0 ? replaced : applyDefaultAlias(replaced, result.defaultAliasTarget));
1946
+ const nextConfig = result.defaultAliasTarget === void 0 ? replaced : applyDefaultAlias(replaced, result.defaultAliasTarget);
1947
+ await writeSetupConfig(path, nextConfig);
1942
1948
  return 0;
1943
1949
  }
1944
1950
  function scalarOption(value, flag) {
@@ -2819,6 +2825,10 @@ function formatFailureGroups(groups, color) {
2819
2825
  for (const failure of group) {
2820
2826
  lines.push(` ${formatTarget(failure)}`);
2821
2827
  lines.push(` [${failure.kind}] ${failure.message}`);
2828
+ for (const cause of failure.causes) {
2829
+ const code = cause.code === void 0 ? "" : `[${cause.code}] `;
2830
+ lines.push(` Caused by: ${code}${cause.message}`);
2831
+ }
2822
2832
  }
2823
2833
  lines.push("");
2824
2834
  }
@@ -2935,7 +2945,7 @@ const UNIT_MS = {
2935
2945
  h: HOUR_MS,
2936
2946
  m: 720 * HOUR_MS,
2937
2947
  w: 168 * HOUR_MS,
2938
- y: 365 * 24 * HOUR_MS
2948
+ y: 8760 * HOUR_MS
2939
2949
  };
2940
2950
  function parseSince(time, now) {
2941
2951
  if (time === void 0 || time === "") return;
@@ -3690,7 +3700,8 @@ async function runInteractiveSetup(io) {
3690
3700
  providers: [result.provider],
3691
3701
  version: 1
3692
3702
  });
3693
- await writeSetupConfig(configPath, result.defaultAliasTarget === void 0 ? merged : applyDefaultAlias(merged, result.defaultAliasTarget));
3703
+ const nextConfig = result.defaultAliasTarget === void 0 ? merged : applyDefaultAlias(merged, result.defaultAliasTarget);
3704
+ await writeSetupConfig(configPath, nextConfig);
3694
3705
  prompts.outro(`Wrote ${configPath}`);
3695
3706
  return 0;
3696
3707
  }
@@ -3770,7 +3781,9 @@ async function runSetupCommand(options, io) {
3770
3781
  return 2;
3771
3782
  }
3772
3783
  const setupConfigPath = options.local ? getProjectSetupConfigPath(io.cwd) : getGlobalSetupConfigPath(io.env ?? process.env);
3773
- await writeSetupConfig(setupConfigPath, mergeSetupConfigs(await loadSetupConfig(setupConfigPath), createSetupConfig(options.providerId, options.providerEndpoint, options)));
3784
+ const existingConfig = await loadSetupConfig(setupConfigPath);
3785
+ const nextConfig = mergeSetupConfigs(existingConfig, createSetupConfig(options.providerId, options.providerEndpoint, options));
3786
+ await writeSetupConfig(setupConfigPath, nextConfig);
3774
3787
  return 0;
3775
3788
  }
3776
3789
  function toArray(value) {
@@ -3969,13 +3982,13 @@ function renderVertical(buckets, values, maxValue, axisWidth, ctx) {
3969
3982
  });
3970
3983
  const gutter = " ".repeat(axisWidth);
3971
3984
  const lines = [];
3972
- for (let row = CHART_HEIGHT - 1; row >= 0; row -= 1) {
3985
+ for (let row = 5; row >= 0; row -= 1) {
3973
3986
  const cells = Array.from({ length: chartWidth }).fill(" ");
3974
3987
  eighths.forEach((total, index) => {
3975
3988
  cells[columnAt(index)] = VERTICAL_BLOCKS[Math.max(0, Math.min(8, total - row * 8))];
3976
3989
  });
3977
- const label = row === CHART_HEIGHT - 1 ? formatMetricValue(maxValue, ctx.metric, ctx.exact).padStart(axisWidth) : gutter;
3978
- const axis = row === CHART_HEIGHT - 1 ? "┤" : "│";
3990
+ const label = row === 5 ? formatMetricValue(maxValue, ctx.metric, ctx.exact).padStart(axisWidth) : gutter;
3991
+ const axis = row === 5 ? "┤" : "│";
3979
3992
  lines.push(`${label} ${axis}${ctx.paint(cells.join("").replace(/\s+$/u, ""), colors.cyan)}`);
3980
3993
  }
3981
3994
  const baseline = Array.from({ length: chartWidth }).fill("─");
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as formatJson, n as formatDiagnostics, r as formatStylish, t as executeCli } from "./cli-3Ov9-ZVf.mjs";
1
+ import { i as formatJson, n as formatDiagnostics, r as formatStylish, t as executeCli } from "./cli-CL433bER.mjs";
2
2
  import { ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated } from "@alint-js/config";
3
3
  import { defineConfig } from "@alint-js/core";
4
4
  export { defineConfig, executeCli, formatDiagnostics, formatJson, formatStylish, ignorePatternsAIAgents, ignorePatternsBuildOutputs, ignorePatternsCaches, ignorePatternsCommon, ignorePatternsEslintDefaults, ignorePatternsGenerated };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/cli",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.1",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -24,12 +24,12 @@
24
24
  "fast-string-truncated-width": "^3.0.3",
25
25
  "fast-string-width": "^3.0.2",
26
26
  "gitignore-fs": "^2.2.3",
27
- "minimatch": "^10.2.5",
27
+ "minimatch": "^10.2.6",
28
28
  "pathe": "^2.0.3",
29
29
  "table": "^6.9.0",
30
- "tinyrainbow": "^3.1.0",
31
- "@alint-js/config": "0.2.0",
32
- "@alint-js/core": "0.2.0"
30
+ "tinyrainbow": "^3.1.1",
31
+ "@alint-js/config": "0.3.1",
32
+ "@alint-js/core": "0.3.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@pnpm/find-workspace-dir": "^1000.1.5",