@alxwlw/stack 1.9.0 → 1.9.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,48 +1,48 @@
1
1
  {
2
2
  "dev": {
3
3
  "typescript": "7.0.2",
4
- "oxlint": "1.88.0",
5
- "oxlint-tsgolint": "7.0.2004",
6
- "oxfmt": "0.73.0",
7
- "@types/node": "26.6.5",
8
- "@types/bun": "1.4.3",
9
- "knip": "6.42.0",
10
- "dependency-cruiser": "18.6.0",
11
- "vitest": "4.1.12",
4
+ "oxlint": "1.90.0",
5
+ "oxlint-tsgolint": "7.0.2005",
6
+ "oxfmt": "0.75.0",
7
+ "@types/node": "26.6.6",
8
+ "@types/bun": "1.4.4",
9
+ "knip": "6.44.1",
10
+ "dependency-cruiser": "18.7.1",
11
+ "vitest": "5.1.0",
12
12
  "@playwright/test": "1.64.1",
13
- "@alxwlw/stack": "1.9.0",
14
- "@alxwlw/oxlint-config": "1.9.0",
15
- "@alxwlw/tsconfig": "1.9.0"
13
+ "@alxwlw/stack": "1.9.1",
14
+ "@alxwlw/oxlint-config": "1.9.1",
15
+ "@alxwlw/tsconfig": "1.9.1"
16
16
  },
17
17
  "libs": {
18
- "@nestjs/core": "12.2.0",
19
- "@nestjs/common": "12.2.0",
20
- "@nestjs/platform-express": "12.2.0",
21
- "@nestjs/testing": "12.2.0",
18
+ "@nestjs/core": "12.3.2",
19
+ "@nestjs/common": "12.3.2",
20
+ "@nestjs/platform-express": "12.3.2",
21
+ "@nestjs/testing": "12.3.2",
22
22
  "reflect-metadata": "0.2.2",
23
23
  "rxjs": "7.8.2",
24
24
  "@prisma/client": "7.10.1",
25
25
  "prisma": "7.10.1",
26
26
  "pg": "8.23.1",
27
27
  "@types/pg": "8.23.1",
28
- "ioredis": "5.11.1",
28
+ "ioredis": "6.0.0",
29
29
  "@nats-io/jetstream": "3.4.0",
30
30
  "@nats-io/nats-core": "3.4.0",
31
- "@opentelemetry/api": "1.9.1",
32
- "@opentelemetry/sdk-metrics": "2.12.0",
31
+ "@opentelemetry/api": "1.10.0",
32
+ "@opentelemetry/sdk-metrics": "3.0.0",
33
33
  "zod": "4.6.7",
34
34
  "react": "19.3.1",
35
35
  "react-dom": "19.3.1",
36
36
  "@types/react": "19.3.0",
37
37
  "@types/react-dom": "19.3.0",
38
- "react-router": "8.4.0",
39
- "@tanstack/react-query": "5.104.4",
40
- "@tanstack/react-table": "8.21.3",
41
- "zustand": "5.0.15",
38
+ "react-router": "8.5.1",
39
+ "@tanstack/react-query": "5.105.2",
40
+ "@tanstack/react-table": "9.3.1",
41
+ "zustand": "5.0.16",
42
42
  "@dnd-kit/core": "6.3.1",
43
43
  "tailwindcss": "4.3.3",
44
44
  "@tailwindcss/vite": "4.3.3",
45
- "lucide-react": "1.59.0",
45
+ "lucide-react": "1.66.0",
46
46
  "@fontsource/ibm-plex-sans": "5.3.0",
47
47
  "@fontsource/ibm-plex-mono": "5.3.0",
48
48
  "@fontsource/ibm-plex-serif": "5.3.0"
@@ -1,10 +1,10 @@
1
1
  # Canon pins. This file is sync-managed: edits happen in alxwlw/stack, not here.
2
- proto = "0.63.1"
3
- node = "26.12.0"
4
- pnpm = "12.14.0"
5
- bun = "1.4.3"
6
- moon = "2.6.2"
7
- uv = "0.13.1"
2
+ proto = "0.63.2"
3
+ node = "26.13.0"
4
+ pnpm = "12.16.1"
5
+ bun = "1.4.4"
6
+ moon = "2.6.5"
7
+ uv = "0.13.6"
8
8
 
9
9
  # Guardrail binaries: versions pinned for reproducibility.
10
10
  actionlint = "1.7.12"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alxwlw/stack",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
package/src/canon.ts CHANGED
@@ -38,25 +38,8 @@ export function canonDir(): string {
38
38
  return join(dirname(fileURLToPath(import.meta.url)), '..', 'canon');
39
39
  }
40
40
 
41
- export function loadManifest(dir: string = canonDir()): CanonFile[] {
42
- const raw = JSON.parse(readFileSync(join(dir, 'manifest.json'), 'utf8')) as {
43
- files: CanonFile[];
44
- };
45
- return raw.files;
46
- }
47
-
48
- export function filesFor(cfg: StackConfig, dir: string = canonDir()): CanonFile[] {
49
- return loadManifest(dir).filter(
50
- (f) => f.appliesTo.includes(cfg.profile) && (f.group == null || cfg.with.includes(f.group)),
51
- );
52
- }
53
-
54
- export function loadCatalogs(dir: string = canonDir()): CanonCatalogs {
55
- return JSON.parse(readFileSync(join(dir, 'catalogs.json'), 'utf8')) as CanonCatalogs;
56
- }
57
-
58
41
  // Устаревшие группы принимаются ради старых .stack.jsonc и ничего не включают.
59
- export const DEPRECATED_GROUPS: readonly string[] = ['renovate'];
42
+ const DEPRECATED_GROUPS: readonly string[] = ['renovate'];
60
43
 
61
44
  export interface CanonGroups {
62
45
  files: string[];
@@ -64,15 +47,35 @@ export interface CanonGroups {
64
47
  deprecated: readonly string[];
65
48
  }
66
49
 
67
- // Единственный источник имён групп: файловые — поле group манифеста, каталожные — ключи catalogs.json.
68
- export function canonGroups(dir: string = canonDir()): CanonGroups {
69
- const files = [...new Set(loadManifest(dir).flatMap((f) => (f.group == null ? [] : [f.group])))];
70
- const catalogs = Object.keys(loadCatalogs(dir)).filter((g) => g !== 'dev');
71
- return { files, catalogs, deprecated: DEPRECATED_GROUPS };
50
+ // canon/ как значение: все записи манифеста с содержимым, каталоги и имена групп. Читается один раз;
51
+ // выбор под профиль и with — чистый шаг canonFor.
52
+ export interface CanonSource {
53
+ entries: readonly (CanonFile & { content: string })[];
54
+ catalogs: CanonCatalogs;
55
+ groups: CanonGroups;
72
56
  }
73
57
 
74
- export function assertKnownGroups(groups: readonly string[], dir: string = canonDir()): void {
75
- const g = canonGroups(dir);
58
+ // Единственное место, где canon/ читается с диска: manifest.json и catalogs.json по разу, каждый src по разу.
59
+ // Имена групп: файловые — поле group манифеста, каталожные — ключи catalogs.json кроме dev.
60
+ export function readCanonSource(dir: string = canonDir()): CanonSource {
61
+ const manifest = JSON.parse(readFileSync(join(dir, 'manifest.json'), 'utf8')) as {
62
+ files: CanonFile[];
63
+ };
64
+ const catalogs = JSON.parse(readFileSync(join(dir, 'catalogs.json'), 'utf8')) as CanonCatalogs;
65
+ const entries = manifest.files.map((f) => ({
66
+ ...f,
67
+ content: readFileSync(join(dir, f.src), 'utf8'),
68
+ }));
69
+ const groups: CanonGroups = {
70
+ files: [...new Set(entries.flatMap((f) => (f.group == null ? [] : [f.group])))],
71
+ catalogs: Object.keys(catalogs).filter((g) => g !== 'dev'),
72
+ deprecated: DEPRECATED_GROUPS,
73
+ };
74
+ return { entries, catalogs, groups };
75
+ }
76
+
77
+ export function assertKnownGroups(groups: readonly string[], source: CanonSource): void {
78
+ const g = source.groups;
76
79
  const known = [...g.files, ...g.catalogs, ...g.deprecated].sort();
77
80
  for (const name of groups) {
78
81
  if (!known.includes(name)) {
@@ -83,15 +86,24 @@ export function assertKnownGroups(groups: readonly string[], dir: string = canon
83
86
  }
84
87
  }
85
88
 
86
- export function loadCanon(cfg: StackConfig, dir: string = canonDir()): Canon {
87
- assertKnownGroups(cfg.with, dir);
88
- const files = filesFor(cfg, dir).map((f) => ({
89
+ // Единственный предикат выбора: запись приходит в канон профиля, если профиль в appliesTo, а группа
90
+ // (если есть) включена через with. Им же пользуются гварды тестов, у которых нет права на свою копию.
91
+ export function selectEntries(source: CanonSource, cfg: StackConfig): CanonSource['entries'] {
92
+ return source.entries.filter(
93
+ (f) => f.appliesTo.includes(cfg.profile) && (f.group == null || cfg.with.includes(f.group)),
94
+ );
95
+ }
96
+
97
+ // Чистый шаг от источника к Canon: проверка групп, выбор записей, каталоги, пины. Диск не трогает.
98
+ export function canonFor(source: CanonSource, cfg: StackConfig): Canon {
99
+ assertKnownGroups(cfg.with, source);
100
+ const files = selectEntries(source, cfg).map((f) => ({
89
101
  dest: f.dest,
90
- content: readFileSync(join(dir, f.src), 'utf8'),
102
+ content: f.content,
91
103
  strategy: f.strategy,
92
104
  satisfiedBy: f.satisfiedBy,
93
105
  }));
94
- const all = loadCatalogs(dir);
106
+ const all = source.catalogs;
95
107
  const groups = ['dev', ...cfg.with];
96
108
  const catalogs = Object.fromEntries(
97
109
  groups.filter((g) => g in all).map((g) => [g, all[g] as Record<string, string>]),
@@ -109,8 +121,12 @@ export function loadCanon(cfg: StackConfig, dir: string = canonDir()): Canon {
109
121
  return { files, catalogs, pins: { ...rest, node, pnpm } };
110
122
  }
111
123
 
124
+ export function loadCanon(cfg: StackConfig, dir: string = canonDir()): Canon {
125
+ return canonFor(readCanonSource(dir), cfg);
126
+ }
127
+
112
128
  // Строковые значения верхнего уровня .prototools; таблица [plugins] и нестроковые значения — не пины.
113
- export function parsePins(prototools: string): Record<string, string> {
129
+ function parsePins(prototools: string): Record<string, string> {
114
130
  const parsed = Bun.TOML.parse(prototools) as Record<string, unknown>;
115
131
  return Object.fromEntries(
116
132
  Object.entries(parsed).filter((e): e is [string, string] => typeof e[1] === 'string'),
package/src/cli.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { existsSync } from 'node:fs';
3
3
  import { parseArgs } from 'node:util';
4
4
 
5
- import { assertKnownGroups, loadCanon } from './canon.ts';
5
+ import { assertKnownGroups, loadCanon, readCanonSource } from './canon.ts';
6
6
  import { checkRepo, syncRepo } from './check.ts';
7
7
  import { type Profile, PROFILES, readStackConfig, StackConfigError } from './config.ts';
8
8
  import { allowedLine, isHeld } from './exceptions.ts';
@@ -55,7 +55,7 @@ try {
55
55
  if (!PROFILES.includes(profile as Profile)) {
56
56
  fail(`unknown --profile "${profile}", expected one of: ${PROFILES.join(', ')}`);
57
57
  }
58
- assertKnownGroups(values.with ?? []);
58
+ assertKnownGroups(values.with ?? [], readCanonSource());
59
59
  const path = initConfig(repoRoot, { profile: profile as Profile, with: values.with ?? [] });
60
60
  console.log(`created ${path}`);
61
61
  } else if (command === 'sync') {