@konce-pt/ui 0.12.0 → 0.14.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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  <p align="center">
2
- <img src="https://ui.konce.pt/images/koncept_ui_lib.png" alt="Koncept UI — Angular component library" width="100%" />
2
+ <img src="https://ui.konce.pt/images/koncept_ui_lib.png" alt="Koncept UI - Angular component library" width="100%" />
3
3
  </p>
4
4
 
5
5
  # @konce-pt/ui
6
6
 
7
- CLI Koncept UI — instaluje **bloki** (gotowe fragmenty UI) do projektu Angular w modelu
7
+ CLI Koncept UI - instaluje **bloki** (gotowe fragmenty UI) do projektu Angular w modelu
8
8
  copy-paste. Po instalacji blok jest Twoim kodem.
9
9
 
10
10
  ```bash
@@ -18,18 +18,18 @@ npx @konce-pt/ui add nip-lookup-field
18
18
  |---|---|
19
19
  | `init` | Tworzy `konce.json` (`--registry --blocks-dir --alias --prefix --theme --force`) |
20
20
  | `add <nazwa...>` | Instaluje blok(i) + zależności registry (`--overwrite --dry-run --path --registry`) |
21
- | `list [--category=…]` | Lista dostępnych bloków |
21
+ | `list [--category=...]` | Lista dostępnych bloków |
22
22
 
23
23
  ## Jak działa `add`
24
24
 
25
25
  1. Rozwiązuje zależności registry rekurencyjnie (wykrywa cykle).
26
- 2. Sprawdza zależności npm — brak: ostrzega, za niska wersja: przerywa.
27
- 3. Przepisuje `@/` → `alias`, selektory `kpt-` → `prefix` (tokeny `--kpt-*` zostają nietknięte).
26
+ 2. Sprawdza zależności npm - brak: ostrzega, za niska wersja: przerywa.
27
+ 3. Przepisuje `@/` -> `alias`, selektory `kpt-` -> `prefix` (tokeny `--kpt-*` zostają nietknięte).
28
28
  4. Konflikt pliku: identyczny pomija, różny zapisuje jako `.new` (lub `--overwrite`).
29
29
  5. Zapisuje dopiero po pobraniu wszystkich plików; odnotowuje `installedBlocks`.
30
30
  6. Wypisuje: dodane pliki, przykład użycia, porty do podpięcia, uwagi.
31
31
 
32
- `--dry-run` przechodzi całą ścieżkę bez zapisu — idealne dla agentów AI do podglądu skutków.
32
+ `--dry-run` przechodzi całą ścieżkę bez zapisu - idealne dla agentów AI do podglądu skutków.
33
33
 
34
34
  Pełny opis: [`llms.txt`](https://ui.konce.pt/llms/cli/llms.txt) (EN)
35
35
  i [`llms-pl.txt`](https://ui.konce.pt/llms/cli/llms-pl.txt) (PL).
@@ -32,11 +32,11 @@ export async function addCommand(args) {
32
32
  for (const name of toInstall)
33
33
  metas.set(name, await loadBlockMeta(ctx.base, name));
34
34
  checkNpmDependencies(metas, ctx.projectRoot);
35
- // 4) Pobierz WSZYSTKIE pliki i zaplanuj zapis (instalacja atomowa — nic nie zapisujemy wcześniej).
35
+ // 4) Pobierz WSZYSTKIE pliki i zaplanuj zapis (instalacja atomowa - nic nie zapisujemy wcześniej).
36
36
  const plan = await planWrites(toInstall, metas, ctx);
37
37
  // 5) Zapis (albo raport dry-run).
38
38
  if (dryRun) {
39
- log.info('— dry-run: nothing written —');
39
+ log.info('- dry-run: nothing written -');
40
40
  for (const p of plan)
41
41
  log.step(`${labelFor(p.action)} ${p.target}`);
42
42
  }
@@ -47,7 +47,7 @@ export async function addCommand(args) {
47
47
  }
48
48
  printSummary(toInstall, metas, dryRun);
49
49
  }
50
- // — pomocnicze —
50
+ // - pomocnicze -
51
51
  /** Kolejność instalacji: zależności registry przed blokiem, który ich potrzebuje. Wykrywa cykle. */
52
52
  function resolveOrder(requested, index) {
53
53
  const order = [];
@@ -77,11 +77,11 @@ function logAlreadyInstalled(order, ctx) {
77
77
  return;
78
78
  for (const name of order) {
79
79
  if (ctx.config.installedBlocks[name]) {
80
- log.step(`${name} — already installed (skipping; --overwrite would replace it)`);
80
+ log.step(`${name} - already installed (skipping; --overwrite would replace it)`);
81
81
  }
82
82
  }
83
83
  }
84
- /** Pobiera pliki wszystkich bloków i planuje zapis — bez dotykania dysku. */
84
+ /** Pobiera pliki wszystkich bloków i planuje zapis - bez dotykania dysku. */
85
85
  async function planWrites(toInstall, metas, ctx) {
86
86
  const plan = [];
87
87
  for (const name of toInstall) {
@@ -128,11 +128,11 @@ function labelFor(action) {
128
128
  switch (action) {
129
129
  case 'write': return 'new ';
130
130
  case 'overwrite': return 'overwrote';
131
- case 'conflict-new': return 'conflict→.new';
131
+ case 'conflict-new': return 'conflict->.new';
132
132
  case 'skip-identical': return 'unchanged';
133
133
  }
134
134
  }
135
- /** Przepisuje placeholdery: `@/` → alias, selektory `kpt-` → prefix (nie rusza `--kpt-`). */
135
+ /** Przepisuje placeholdery: `@/` -> alias, selektory `kpt-` -> prefix (nie rusza `--kpt-`). */
136
136
  function rewriteImports(content, config) {
137
137
  let out = content.replaceAll('@/', `${config.alias}/`);
138
138
  if (config.prefix !== 'kpt') {
@@ -144,14 +144,14 @@ function rewriteImports(content, config) {
144
144
  * Weryfikuje zależności bloku względem package.json projektu.
145
145
  *
146
146
  * Rozróżnienie surowości jest celowe: `npm` to nasze paczki i zła wersja realnie
147
- * psuje blok, więc przerywamy. `peer` to Angular i rxjs — ich wersję trzyma
147
+ * psuje blok, więc przerywamy. `peer` to Angular i rxjs - ich wersję trzyma
148
148
  * aplikacja, a twardy błąd na prerelease, którego prosty parser może odczytać
149
149
  * inaczej niż npm, byłby gorszy od ostrzeżenia.
150
150
  */
151
151
  function checkNpmDependencies(metas, projectRoot) {
152
152
  const installed = readInstalledDeps(projectRoot);
153
153
  const missing = new Map();
154
- // Set, bo kilka bloków deklaruje zwykle ten sam peer (@angular/core) — bez tego
154
+ // Set, bo kilka bloków deklaruje zwykle ten sam peer (@angular/core) - bez tego
155
155
  // to samo ostrzeżenie poszłoby raz na blok.
156
156
  const peerNotes = new Set();
157
157
  for (const { kind, name, range } of declaredDependencies(metas)) {
@@ -169,7 +169,7 @@ function checkNpmDependencies(metas, projectRoot) {
169
169
  continue;
170
170
  }
171
171
  peerNotes.add(verdict === 'missing'
172
- ? `${name} (peer) — not in the project, the block needs ${range}`
172
+ ? `${name} (peer) - not in the project, the block needs ${range}`
173
173
  : `${name} (peer) is at version ${have}, the block needs ${range}`);
174
174
  }
175
175
  reportMissing(missing);
@@ -182,7 +182,7 @@ function readInstalledDeps(projectRoot) {
182
182
  if (!existsSync(pkgPath))
183
183
  return {};
184
184
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
185
- // Rozwinięcie `undefined` w literale obiektu jest legalne i nic nie wnosi — bez `?? {}`.
185
+ // Rozwinięcie `undefined` w literale obiektu jest legalne i nic nie wnosi - bez `?? {}`.
186
186
  return { ...pkg.dependencies, ...pkg.devDependencies };
187
187
  }
188
188
  /** Płaska lista zależności zadeklarowanych przez wszystkie instalowane bloki. */
@@ -198,11 +198,11 @@ function* dependenciesOfKind(kind, deps) {
198
198
  for (const [name, range] of Object.entries(deps))
199
199
  yield { kind, name, range };
200
200
  }
201
- /** Werdykt dla jednej zależności — bez rozróżnienia na npm/peer, to robi wołający. */
201
+ /** Werdykt dla jednej zależności - bez rozróżnienia na npm/peer, to robi wołający. */
202
202
  function inspectDependency(range, have) {
203
203
  if (!have)
204
204
  return 'missing';
205
- // Specyfikatory bez konkretnej wersji (workspace:*, *, latest, git/file:) — nie oceniamy.
205
+ // Specyfikatory bez konkretnej wersji (workspace:*, *, latest, git/file:) - nie oceniamy.
206
206
  if (!/\d/.test(have))
207
207
  return 'ok';
208
208
  return satisfies(have, range) ? 'ok' : 'mismatch';
@@ -210,9 +210,9 @@ function inspectDependency(range, have) {
210
210
  function reportMissing(missing) {
211
211
  if (missing.size === 0)
212
212
  return;
213
- // Do instalacji podajemy same nazwy — zakres bywa złożony (">=0.6.0 <1.0.0")
213
+ // Do instalacji podajemy same nazwy - zakres bywa złożony (">=0.6.0 <1.0.0")
214
214
  // i wklejony do shella by się rozpadł. Wymagania pokazujemy osobno.
215
- log.warn(`Missing npm dependencies — install them: ${[...missing.keys()].join(' ')}`);
215
+ log.warn(`Missing npm dependencies - install them: ${[...missing.keys()].join(' ')}`);
216
216
  for (const [name, range] of missing)
217
217
  log.step(`${name} needs ${range}`);
218
218
  }
@@ -226,7 +226,7 @@ function printSummary(installed, metas, dryRun) {
226
226
  }
227
227
  const ports = meta.api?.ports ?? [];
228
228
  for (const port of ports) {
229
- log.warn(`port to wire up: ${port.token} — ${port.signature}${port.stubProvided ? ' (a stub is included)' : ''}`);
229
+ log.warn(`port to wire up: ${port.token} - ${port.signature}${port.stubProvided ? ' (a stub is included)' : ''}`);
230
230
  }
231
231
  if (meta.notes)
232
232
  log.step(`note: ${meta.notes}`);
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { parseArgs, log, UserError } from "./util.js";
3
3
  import { initCommand } from "./commands/init.js";
4
4
  import { listCommand } from "./commands/list.js";
5
5
  import { addCommand } from "./commands/add.js";
6
- const HELP = `Koncept UI — the block CLI.
6
+ const HELP = `Koncept UI - the block CLI.
7
7
 
8
8
  Usage:
9
9
  npx @konce-pt/ui <command> [options]
package/dist/semver.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // Minimalna obsługa zakresów semver. CLI ma zero zależności runtime
2
- // (package.json → "dependencies": {}), więc zamiast paczki `semver` niesiemy tyle
2
+ // (package.json -> "dependencies": {}), więc zamiast paczki `semver` niesiemy tyle
3
3
  // kodu, ile pokrywa realne kształty zakresów z registry i z package.json aplikacji:
4
4
  // ">=0.6.0 <1.0.0", "^22.0.0", "~1.2.3", "1.2.3", oraz alternatywy przez "||".
5
5
  //
6
6
  // Zasada bezpieczeństwa: czego nie rozumiemy, tego nie oceniamy. Zablokowanie
7
7
  // instalacji z powodu składni nieznanej naszemu parserowi byłoby gorsze niż
8
- // pominięcie kontroli — stąd `satisfies` zwraca `true` dla zakresów, których nie
8
+ // pominięcie kontroli - stąd `satisfies` zwraca `true` dla zakresów, których nie
9
9
  // potrafi rozłożyć.
10
10
  /** Wyciąga trójkę z wersji; toleruje prefiksy (`v1.2.3`) i sufiksy (`1.2.3-rc.1`). */
11
11
  export function parseVersion(input) {
@@ -38,7 +38,7 @@ function satisfiesOne(version, comparator) {
38
38
  return null;
39
39
  const [, op, rest] = m;
40
40
  if (/[x*]/i.test(rest))
41
- return null; // 1.x / 1.* — poza zakresem tego parsera
41
+ return null; // 1.x / 1.* - poza zakresem tego parsera
42
42
  const target = parseVersion(rest);
43
43
  if (!target)
44
44
  return null;
@@ -55,7 +55,7 @@ function satisfiesOne(version, comparator) {
55
55
  /**
56
56
  * Czy `version` mieści się w `range`. Obsługuje koniunkcję przez spację
57
57
  * (">=0.6.0 <1.0.0") i alternatywę przez "||". Zakres, którego nie da się
58
- * rozłożyć, traktujemy jako spełniony — patrz nagłówek pliku.
58
+ * rozłożyć, traktujemy jako spełniony - patrz nagłówek pliku.
59
59
  */
60
60
  export function satisfies(version, range) {
61
61
  const parsed = parseVersion(version);
@@ -67,7 +67,7 @@ export function satisfies(version, range) {
67
67
  continue;
68
68
  const results = comparators.map((c) => satisfiesOne(parsed, c));
69
69
  if (results.includes(null))
70
- return true; // nieznany kształt — nie oceniamy
70
+ return true; // nieznany kształt - nie oceniamy
71
71
  if (results.every(Boolean))
72
72
  return true;
73
73
  }
package/dist/util.js CHANGED
@@ -26,9 +26,9 @@ export function hasFlag(args, name) {
26
26
  export const log = {
27
27
  info: (msg) => console.log(msg),
28
28
  step: (msg) => console.log(` ${msg}`),
29
- ok: (msg) => console.log(`✓ ${msg}`),
29
+ ok: (msg) => console.log(`OK: ${msg}`),
30
30
  warn: (msg) => console.warn(`! ${msg}`),
31
- error: (msg) => console.error(`✗ ${msg}`),
31
+ error: (msg) => console.error(`ERROR: ${msg}`),
32
32
  };
33
33
  /** Błąd, którego komunikat wystarczy pokazać userowi (bez stack trace). */
34
34
  export class UserError extends Error {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@konce-pt/ui",
3
- "version": "0.12.0",
4
- "description": "The Koncept UI CLI — installs blocks (copy-paste) into an Angular project: init, add, list.",
3
+ "version": "0.14.0",
4
+ "description": "The Koncept UI CLI - installs blocks (copy-paste) into an Angular project: init, add, list.",
5
5
  "license": "MIT",
6
6
  "author": "konce.pt",
7
7
  "homepage": "https://ui.konce.pt/",