akademia 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -1,34 +1,42 @@
1
1
  # Akademia CLI
2
2
 
3
- CLI do publicznego API Akademia.pl.
3
+ Prosty dostęp do publicznych promptów i checklist Akademia.pl z terminala.
4
4
 
5
5
  ## Instalacja
6
6
 
7
7
  ```bash
8
8
  npm install -g akademia
9
- akademia --help
9
+ akademia
10
10
  ```
11
11
 
12
- ## Komendy
12
+ Po instalacji wpisz:
13
13
 
14
14
  ```bash
15
- akademia doctor
16
- akademia search "landing page"
17
- akademia show wywiad-przed-startem-projektu
15
+ akademia pomoc
18
16
  ```
19
17
 
20
- ## Konfiguracja
18
+ ## Podstawowe użycie
21
19
 
22
- Domyślne API:
20
+ ```bash
21
+ akademia szukaj "landing page"
22
+ akademia pokaz wywiad-przed-startem-projektu
23
+ akademia status
24
+ ```
25
+
26
+ ## Prywatność
27
+
28
+ CLI V1 pobiera tylko publiczne pliki JSON. Nie wysyła kodu projektu, plików, maili ani danych klientów do Akademii.
29
+
30
+ ## API
31
+
32
+ Domyślnie CLI łączy się z:
23
33
 
24
34
  ```bash
25
35
  https://akademia.pl
26
36
  ```
27
37
 
28
- Możesz podmienić endpoint:
38
+ Technicznie możesz podmienić endpoint:
29
39
 
30
40
  ```bash
31
- AKADEMIA_API_BASE=http://127.0.0.1:8898 akademia doctor
41
+ AKADEMIA_API_BASE=http://127.0.0.1:8898 akademia status
32
42
  ```
33
-
34
- CLI V1 pobiera tylko publiczne pliki JSON. Nie wysyła kodu projektu, plików, maili ani danych klientów do Akademii.
package/bin/akademia.js CHANGED
@@ -5,7 +5,7 @@ import { scanProject } from "../src/scan.js";
5
5
  import { searchResources } from "../src/search.js";
6
6
  import { printDoctor, printResource, printScanResults, printSearchResults } from "../src/format.js";
7
7
 
8
- const VERSION = "0.1.0";
8
+ const VERSION = "0.1.1";
9
9
 
10
10
  async function main(argv) {
11
11
  const { command, args, flags } = parseArgs(argv);
@@ -16,20 +16,27 @@ async function main(argv) {
16
16
  return;
17
17
  }
18
18
 
19
- if (!command || flags.help) {
19
+ if (flags.help || isHelpCommand(command)) {
20
20
  printHelp();
21
21
  return;
22
22
  }
23
23
 
24
- if (command === "doctor") {
24
+ if (!command) {
25
+ await printStart(client);
26
+ return;
27
+ }
28
+
29
+ const action = normalizeCommand(command);
30
+
31
+ if (action === "doctor") {
25
32
  const catalog = await client.catalog();
26
33
  printDoctor(catalog, client.baseUrl);
27
34
  return;
28
35
  }
29
36
 
30
- if (command === "search") {
37
+ if (action === "search") {
31
38
  const query = args.join(" ").trim();
32
- if (!query) throw new Error("Podaj frazę, np. akademia search \"landing page\".");
39
+ if (!query) throw new Error("Podaj frazę, np. akademia szukaj \"landing page\".");
33
40
  const index = await client.searchIndex();
34
41
  const results = searchResources(index, query, {
35
42
  limit: flags.limit || 10,
@@ -39,15 +46,15 @@ async function main(argv) {
39
46
  return;
40
47
  }
41
48
 
42
- if (command === "show") {
49
+ if (action === "show") {
43
50
  const id = args[0];
44
- if (!id) throw new Error("Podaj ID zasobu, np. akademia show wywiad-przed-startem-projektu.");
51
+ if (!id) throw new Error("Podaj ID zasobu, np. akademia pokaz wywiad-przed-startem-projektu.");
45
52
  const resource = await client.resource(id);
46
53
  printResource(resource, { full: flags.full });
47
54
  return;
48
55
  }
49
56
 
50
- if (command === "scan") {
57
+ if (action === "scan") {
51
58
  const target = args[0] || ".";
52
59
  const index = await client.searchIndex();
53
60
  const result = await scanProject(target, index, {
@@ -62,7 +69,7 @@ async function main(argv) {
62
69
  return;
63
70
  }
64
71
 
65
- if (command === "report") {
72
+ if (action === "report") {
66
73
  const target = args[0] || ".";
67
74
  const index = await client.searchIndex();
68
75
  const result = await scanProject(target, index, {
@@ -75,7 +82,7 @@ async function main(argv) {
75
82
  return;
76
83
  }
77
84
 
78
- throw new Error(`Nieznana komenda: ${command}`);
85
+ throw new Error(`Nie znam tej komendy. Wpisz: akademia pomoc`);
79
86
  }
80
87
 
81
88
  function parseArgs(argv) {
@@ -136,28 +143,72 @@ function parseArgs(argv) {
136
143
  return { command, args, flags };
137
144
  }
138
145
 
146
+ function normalizeCommand(command) {
147
+ const commands = new Map([
148
+ ["doctor", "doctor"],
149
+ ["status", "doctor"],
150
+ ["search", "search"],
151
+ ["szukaj", "search"],
152
+ ["show", "show"],
153
+ ["pokaz", "show"],
154
+ ["pokaż", "show"],
155
+ ["scan", "scan"],
156
+ ["report", "report"]
157
+ ]);
158
+
159
+ return commands.get(command) || command;
160
+ }
161
+
162
+ function isHelpCommand(command) {
163
+ return command === "help" || command === "pomoc";
164
+ }
165
+
166
+ async function printStart(client) {
167
+ try {
168
+ const catalog = await client.catalog();
169
+ const resources = catalog?.resources || [];
170
+ const total = resources.length;
171
+ const prompts = resources.filter((item) => item.type === "prompt").length;
172
+ const checklists = resources.filter((item) => item.type === "checklist").length;
173
+
174
+ console.log(`Akademia.pl CLI ${VERSION}
175
+
176
+ Łączy terminal z publicznymi promptami i checklistami Akademii.
177
+
178
+ Status: działa
179
+ Zasoby: ${total} publicznych materiałów, ${prompts} promptów, ${checklists} checklist
180
+
181
+ Następny krok:
182
+ akademia pomoc
183
+ `);
184
+ return;
185
+ } catch (error) {
186
+ console.log(`Akademia.pl CLI ${VERSION}
187
+
188
+ CLI jest zainstalowane, ale nie udało się połączyć z Akademia.pl.
189
+
190
+ Następny krok:
191
+ akademia pomoc
192
+
193
+ Szczegół techniczny: ${error.message}
194
+ `);
195
+ }
196
+ }
197
+
139
198
  function printHelp() {
140
- console.log(`Akademia CLI ${VERSION}
141
-
142
- Użycie:
143
- akademia doctor
144
- akademia search "landing page"
145
- akademia search "umowa" --type prompt --limit 5
146
- akademia show wywiad-przed-startem-projektu
147
- akademia show wywiad-przed-startem-projektu --full
148
- akademia scan .
149
- akademia scan . --limit 5 --max-files 120
150
- akademia report .
151
- akademia report . --out raport-akademii.md
152
-
153
- Flagi:
154
- --base-url URL Nadpisuje API, domyślnie https://akademia.pl
155
- --type TYPE Filtruje search po typie: prompt albo checklist
156
- --limit N Limit wyników search
157
- --max-files N Limit plików czytanych przez scan
158
- --out PATH Ścieżka raportu Markdown dla report
159
- --full Pokazuje pełną treść w show
160
- --json Zwraca wynik scan jako JSON
199
+ console.log(`Akademia.pl CLI ${VERSION}
200
+
201
+ Najprościej:
202
+ akademia
203
+
204
+ Szukaj promptu albo checklisty:
205
+ akademia szukaj "landing page"
206
+
207
+ Pokaż konkretny materiał:
208
+ akademia pokaz wywiad-przed-startem-projektu
209
+
210
+ Sprawdź połączenie:
211
+ akademia status
161
212
  `);
162
213
  }
163
214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akademia",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI Akademia.pl do lokalnego dostępu do promptów i checklist.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/format.js CHANGED
@@ -4,14 +4,15 @@ export function printDoctor(catalog, baseUrl) {
4
4
  const prompts = resources.filter((item) => item.type === "prompt").length;
5
5
  const checklists = resources.filter((item) => item.type === "checklist").length;
6
6
  const security = meta.security || {};
7
+ const connection = resources.length ? "działa" : "brak publicznych zasobów";
7
8
 
8
- console.log("Akademia CLI");
9
+ console.log("Akademia.pl CLI");
10
+ console.log(`Status: ${connection}`);
9
11
  console.log(`API: ${baseUrl}`);
10
- console.log(`Wersja API: ${meta.version || "brak"}`);
11
- console.log(`Zasoby: ${resources.length}, prompty: ${prompts}, checklisty: ${checklists}`);
12
- console.log(`Tryb: ${security.mode || "brak"}`);
13
- console.log(`Przyjmuje dane projektu: ${security.acceptsProjectFiles ? "tak" : "nie"}`);
14
- console.log(`LLM po stronie serwera: ${security.serverSideLlm ? "tak" : "nie"}`);
12
+ console.log(`Zasoby: ${resources.length} publicznych materiałów`);
13
+ console.log(`Prompty: ${prompts}`);
14
+ console.log(`Checklisty: ${checklists}`);
15
+ console.log(`Pliki z Twojego komputera: ${security.acceptsProjectFiles ? "wysyłane" : "nie są wysyłane"}`);
15
16
  }
16
17
 
17
18
  export function printSearchResults(results) {