knowmind 0.1.23 → 0.1.25

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Knowmind CLI — Änderungen
2
2
 
3
+ ## 0.1.25 (2026-06-23)
4
+
5
+ **Geführtes Onboarding nach `install`/`init`**
6
+ - `install` und `init` zeigen nach der Eintragung einen klaren Abschluss-Schritt:
7
+ Liegt kein API-Token vor, wird deutlich auf Konto + Token hingewiesen — der
8
+ häufigste Stolperstein, denn ohne Token bleibt die MCP-Konfig wirkungslos. Mit
9
+ Token: kurze Bestätigung, dass alles startklar ist.
10
+ - `init` akzeptiert jetzt `--token kmt_…` und `--api URL` (konsistent zu `install`)
11
+ und legt die Config gleich mit an, damit die erzeugten Hooks sofort funktionieren,
12
+ statt ohne Token still ins Leere zu laufen.
13
+
3
14
  ## 0.1.23 (2026-06-20)
4
15
 
5
16
  **Neuer Befehl `knowmind install <ide>`**
package/bin/knowmind.js CHANGED
@@ -51,9 +51,10 @@ Knowmind ${VERSION} — Das Gedächtnis für Ihre KI
51
51
  Befehle:
52
52
  knowmind login [--token kmt_TOKEN] [--api https://knowmind.de]
53
53
  Token speichern
54
- knowmind init [--client claude-code|cursor|auto] [--dry-run]
54
+ knowmind init [--client claude-code|cursor|auto] [--token kmt_TOKEN] [--api URL] [--dry-run]
55
55
  Automatische Gedächtnis-Pflege im KI-Client einrichten
56
56
  (Hooks/Regeln + Memory-First-Block). Idempotent.
57
+ --token/--api legen die Config gleich mit an.
57
58
  knowmind config Aktuelle Konfiguration anzeigen
58
59
  knowmind search "Frage" [-k 5] [--hops 2]
59
60
  Hybrid-Recall gegen den Tenant-Korpus
@@ -76,10 +77,50 @@ ENV-Override:
76
77
  `);
77
78
  }
78
79
 
80
+ /**
81
+ * Klarer Hinweis, wo man ein kostenloses Konto + Token bekommt. Wird gezeigt,
82
+ * sobald (noch) kein gültiger Token vorliegt — der häufigste Stolperstein für
83
+ * Erstnutzer. API/CLI sind im kostenlosen Tarif enthalten (bis 2.500 Memories).
84
+ * apiUrl wird dynamisch bezogen (--api / KNOWMIND_API_URL / Default), nie geraten.
85
+ */
86
+ function printRegisterHint(api) {
87
+ const base = api || process.env.KNOWMIND_API_URL || "https://knowmind.de";
88
+ console.log(
89
+ "\nknowmind braucht ein kostenloses Konto + einen API-Token:\n" +
90
+ ` 1. Konto anlegen: ${base}/signin?mode=register\n` +
91
+ ` 2. Token erzeugen: ${base}/dashboard/tokens (Dashboard -> API-Tokens -> Token erstellen)\n` +
92
+ " 3. Einloggen: knowmind login --token kmt_...\n\n" +
93
+ "API und CLI sind im kostenlosen Tarif enthalten (bis 2.500 Erinnerungen).\n",
94
+ );
95
+ }
96
+
97
+ /** Ist ein Token konfiguriert (ENV oder Config-File)? */
98
+ function hasToken() {
99
+ return Boolean(process.env.KNOWMIND_TOKEN || loadConfig().token);
100
+ }
101
+
102
+ /**
103
+ * Geführter Abschluss nach `install`/`init`: Ohne Token bleibt die Eintragung
104
+ * wirkungslos (tote MCP-Konfig) — der häufigste Stolperstein. Bei vorhandenem
105
+ * Token: kurze Bestätigung. Sonst: deutlicher Schluss-Schritt mit Anleitung.
106
+ */
107
+ function finishOnboardingHint() {
108
+ if (hasToken()) {
109
+ console.log("\n✓ Token gefunden — knowmind ist startklar, sobald der Client neu lädt.");
110
+ return;
111
+ }
112
+ console.log(
113
+ "\n⚠ LETZTER SCHRITT: Ohne API-Token ist die Eintragung noch wirkungslos (keine Verbindung).",
114
+ );
115
+ printRegisterHint(parseFlag("--api", null));
116
+ }
117
+
79
118
  async function runLogin() {
80
119
  let token = parseFlag("--token", null);
81
120
  const api = parseFlag("--api", null);
82
121
  if (!token) {
122
+ // Kein Token übergeben -> erst zeigen, wo man ihn herbekommt, dann fragen.
123
+ printRegisterHint(api);
83
124
  // Interaktiv von stdin lesen
84
125
  process.stdout.write("API-Token (kmt_…): ");
85
126
  const line = await new Promise((resolve) => {
@@ -87,8 +128,10 @@ async function runLogin() {
87
128
  });
88
129
  token = line;
89
130
  }
90
- if (!token || !token.startsWith("kmt_"))
131
+ if (!token || !token.startsWith("kmt_")) {
132
+ printRegisterHint(api);
91
133
  throw new Error("Token muss mit kmt_ beginnen.");
134
+ }
92
135
 
93
136
  // Vor dem Speichern: Token gegen Server verifizieren. Sonst wäre jeder
94
137
  // Phantasie-String akzeptiert und alle späteren Aufrufe scheitern erst
@@ -114,6 +157,7 @@ async function runLogin() {
114
157
  process.stdout.write("ABGELEHNT\n");
115
158
  const code = data.error?.code ?? r.status;
116
159
  const msg = data.error?.message ?? `HTTP ${r.status}`;
160
+ printRegisterHint(api);
117
161
  throw new Error(`Token ungültig: ${code} — ${msg}`);
118
162
  }
119
163
  process.stdout.write("ok\n");
@@ -192,18 +236,34 @@ async function runConfig() {
192
236
  async function runInitCmd() {
193
237
  const client = parseFlag("--client", "auto");
194
238
  const dryRun = args.includes("--dry-run");
239
+ // Konsistenz zu `install`: --token/--api direkt verarbeiten und in der Config
240
+ // ablegen, damit die erzeugten Hooks (sie lesen Token/URL aus ~/.knowmind/
241
+ // config.json bzw. ENV) sofort funktionieren statt still ins Leere zu laufen.
242
+ const token = parseFlag("--token", null);
243
+ const api = parseFlag("--api", null);
244
+ if ((token || api) && !dryRun) {
245
+ if (token && !token.startsWith("kmt_")) throw new Error("Token muss mit kmt_ beginnen.");
246
+ const where = saveConfig({ ...(token ? { token } : {}), ...(api ? { apiUrl: api } : {}) });
247
+ if (token) console.log(`Token gespeichert in ${where}.`);
248
+ }
195
249
  console.log(await runInit({ client, dryRun }));
250
+ if (!dryRun) finishOnboardingHint();
196
251
  }
197
252
 
198
253
  async function runInstallCmd() {
254
+ const ideKey = args[1] && !args[1].startsWith("-") ? args[1] : null;
199
255
  runInstall({
200
- ideKey: args[1] && !args[1].startsWith("-") ? args[1] : null,
256
+ ideKey,
201
257
  project: args.includes("--project"),
202
258
  dryRun: args.includes("--dry-run"),
203
259
  printOnly: args.includes("--print"),
204
260
  apiUrl: parseFlag("--api", null),
205
261
  literalToken: parseFlag("--token", null),
206
262
  });
263
+ // Nach echter Eintragung (nicht bei list/--print/--dry-run) zum Token führen.
264
+ if (ideKey && ideKey !== "list" && !args.includes("--print") && !args.includes("--dry-run")) {
265
+ finishOnboardingHint();
266
+ }
207
267
  }
208
268
 
209
269
  // Wichtig: `process.exit(N)` reißt offene Sockets/fetch-Verbindungen mit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knowmind",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "mcpName": "io.github.Schubeler-Consulting/knowmind",
5
5
  "description": "Knowmind — das Agentengehirn aus Deutschland: CLI + MCP-Server (Langzeitgedächtnis & Wissensgraph für Ihre KI, Server in Deutschland).",
6
6
  "type": "module",
package/src/install.js CHANGED
@@ -252,4 +252,16 @@ export function runInstall(opts) {
252
252
  console.log(` → ${path} nutzt \${KNOWMIND_TOKEN} aus der Umgebung (git-sicher).`);
253
253
  }
254
254
  }
255
+
256
+ // Wer ohne --token installiert, braucht noch einen Token aus einem (kostenlosen)
257
+ // Konto — genau hier scheitern Erstnutzer. Daher der klare Weg zum Abschluss.
258
+ if (!literalToken && !dryRun && !printOnly) {
259
+ const base = apiUrl || DEFAULT_API;
260
+ console.log(
261
+ "\nNoch kein Token? knowmind ist im kostenlosen Tarif voll nutzbar (bis 2.500 Erinnerungen):\n" +
262
+ ` 1. Konto anlegen: ${base}/signin?mode=register\n` +
263
+ ` 2. Token erzeugen: ${base}/dashboard/tokens\n` +
264
+ " 3. knowmind login --token kmt_... (oder KNOWMIND_TOKEN setzen)\n",
265
+ );
266
+ }
255
267
  }
package/src/mcp-stdio.js CHANGED
@@ -116,7 +116,7 @@ async function probeAuth() {
116
116
  return {
117
117
  ok: false,
118
118
  reason:
119
- "Kein Knowmind-Token konfiguriert. Bitte `knowmind login` im Terminal ausführen.",
119
+ "Kein Knowmind-Token konfiguriert. Kostenloses Konto + Token: https://knowmind.de/signin?mode=register (danach Dashboard -> API-Tokens), dann `knowmind login` im Terminal.",
120
120
  };
121
121
  }
122
122
  if (!cfg.token.startsWith("kmt_")) {
@@ -181,7 +181,7 @@ export async function runStdioServer() {
181
181
  ? {
182
182
  ok: false,
183
183
  reason:
184
- "Kein Knowmind-Token konfiguriert. Bitte `knowmind login` im Terminal ausführen.",
184
+ "Kein Knowmind-Token konfiguriert. Kostenloses Konto + Token: https://knowmind.de/signin?mode=register (danach Dashboard -> API-Tokens), dann `knowmind login` im Terminal.",
185
185
  }
186
186
  : await probeAuth();
187
187
  if (discoveryMode) {