@alxwlw/stack 1.1.1 → 1.1.2

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.
@@ -10,9 +10,9 @@
10
10
  "dependency-cruiser": "18.1.0",
11
11
  "vitest": "4.1.10",
12
12
  "@playwright/test": "1.62.0",
13
- "@alxwlw/stack": "1.1.1",
14
- "@alxwlw/oxlint-config": "1.1.1",
15
- "@alxwlw/tsconfig": "1.1.1"
13
+ "@alxwlw/stack": "1.1.2",
14
+ "@alxwlw/oxlint-config": "1.1.2",
15
+ "@alxwlw/tsconfig": "1.1.2"
16
16
  },
17
17
  "libs": {
18
18
  "@nestjs/core": "12.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alxwlw/stack",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
package/src/catalogs.ts CHANGED
@@ -48,7 +48,9 @@ export function planCatalogs(repoRoot: string, canon: Canon): Drift[] {
48
48
  // double quotes otherwise, so a freshly-synced workspace fails `oxfmt --check`.
49
49
  // ponytail: doc общий на весь план, файл пишется на каждую запись; один flush в
50
50
  // конце, если ~40 записей первого sync станут заметны.
51
- writeFileSync(path, doc.toString({ singleQuote: true }));
51
+ // lineWidth: 0 — без переноса: по умолчанию yaml режет скаляры длиннее 80 колонок во
52
+ // всём документе, и sync переписал бы строки, к каталогам не относящиеся.
53
+ writeFileSync(path, doc.toString({ singleQuote: true, lineWidth: 0 }));
52
54
  },
53
55
  });
54
56
  }
package/src/cli.ts CHANGED
@@ -5,6 +5,7 @@ import { parseArgs } from 'node:util';
5
5
  import { loadCanon } from './canon.ts';
6
6
  import { checkRepo, syncRepo } from './check.ts';
7
7
  import { type Profile, PROFILES, readStackConfig, StackConfigError } from './config.ts';
8
+ import { type Finding, isDrift } from './findings.ts';
8
9
  import { initConfig } from './init.ts';
9
10
 
10
11
  function fail(message: string): never {
@@ -29,6 +30,17 @@ function parseCliArgs() {
29
30
  }
30
31
  }
31
32
 
33
+ // Подсказка под находками: stack sync закрывает только Drift; правила deps.ts — отчёт без действия.
34
+ function fixHint(blocking: Finding[]): string {
35
+ const total = blocking.length;
36
+ const bySync = blocking.filter(isDrift).length;
37
+ if (bySync === total) return `${total} finding(s). Fix with: stack sync`;
38
+ if (bySync === 0) {
39
+ return `${total} finding(s). stack sync does not fix these — fix them by hand (see above)`;
40
+ }
41
+ return `${total} finding(s): ${bySync} fixable with: stack sync, ${total - bySync} to fix by hand (see above)`;
42
+ }
43
+
32
44
  const { values, positionals } = parseCliArgs();
33
45
 
34
46
  const repoRoot = values.repo ?? process.cwd();
@@ -61,7 +73,7 @@ try {
61
73
  }
62
74
  for (const f of blocking) console.error(`${f.code}: ${f.target} — ${f.message}`);
63
75
  if (blocking.length) {
64
- console.error(`\n${blocking.length} finding(s). Fix with: stack sync`);
76
+ console.error(`\n${fixHint(blocking)}`);
65
77
  process.exit(1);
66
78
  }
67
79
  console.log('canon: no drift');
package/src/findings.ts CHANGED
@@ -29,6 +29,11 @@ export interface Drift extends Finding {
29
29
  apply(): void;
30
30
  }
31
31
 
32
+ // Drift — находка, которую закрывает `stack sync` (у неё есть apply); остальное правят руками.
33
+ export function isDrift(f: Finding): f is Drift {
34
+ return typeof (f as Partial<Drift>).apply === 'function';
35
+ }
36
+
32
37
  export function covers(e: Exception, f: Finding): boolean {
33
38
  const a = f.address;
34
39
  if (!a) return false;