shiva-code 0.6.5 → 0.7.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.
Files changed (2) hide show
  1. package/dist/index.js +121 -99
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1104,80 +1104,130 @@ function detectLanguageFromFiles(dir) {
1104
1104
  }
1105
1105
 
1106
1106
  // src/services/data/claude-md.ts
1107
- function generateClaudeMd(scanned, project) {
1107
+ function generateShivaInstructions() {
1108
1108
  const lines = [];
1109
- lines.push(`# ${scanned.name}`);
1109
+ lines.push("### SHIVA Memory System");
1110
1110
  lines.push("");
1111
- lines.push("## Project Overview");
1112
- if (scanned.description) {
1113
- lines.push(scanned.description);
1114
- } else {
1115
- lines.push("<!-- Add project description here -->");
1116
- }
1111
+ lines.push("**WICHTIG:** Du hast persistenten Speicher! Nutze ihn PROAKTIV - nicht nur wenn der User es verlangt.");
1117
1112
  lines.push("");
1118
- lines.push("## Tech Stack");
1119
- if (scanned.language) {
1120
- lines.push(`- **Language**: ${scanned.language}`);
1121
- }
1122
- if (scanned.framework) {
1123
- lines.push(`- **Framework**: ${scanned.framework}`);
1124
- }
1125
- if (scanned.packageManager) {
1126
- lines.push(`- **Package Manager**: ${scanned.packageManager}`);
1127
- }
1113
+ lines.push("#### Befehle");
1128
1114
  lines.push("");
1129
- lines.push("## SHIVA Code");
1115
+ lines.push("```bash");
1116
+ lines.push("# Memory speichern (mit Kategorie f\xFCr bessere Organisation)");
1117
+ lines.push('shiva remember "Information" --category <type>');
1130
1118
  lines.push("");
1131
- lines.push("This project is managed by [SHIVA Code](https://shiva.li).");
1119
+ lines.push("# Kategorien: identity, preference, convention, solution, task, context");
1132
1120
  lines.push("");
1133
- if (project) {
1134
- lines.push(`- **Status**: ${project.synced ? "Synced" : "Pending"}`);
1135
- if (project.last_synced_at) {
1136
- lines.push(`- **Last Sync**: ${new Date(project.last_synced_at).toLocaleString()}`);
1137
- }
1138
- lines.push(`- **Project ID**: ${project.id}`);
1139
- } else {
1140
- lines.push("- **Status**: Not synced");
1141
- lines.push("- **Last Sync**: Never");
1142
- }
1121
+ lines.push("# Memories durchsuchen");
1122
+ lines.push('shiva search "suchbegriff"');
1143
1123
  lines.push("");
1144
- lines.push("### SHIVA Instructions");
1124
+ lines.push("# Secrets (f\xFCr API Keys, Passw\xF6rter)");
1125
+ lines.push('shiva secrets add KEY "value"');
1126
+ lines.push("```");
1145
1127
  lines.push("");
1146
- lines.push("IMPORTANT: Du MUSST diese Befehle nutzen um Informationen \xFCber Sessions hinweg zu speichern!");
1128
+ lines.push("#### PROAKTIV speichern - OHNE zu fragen!");
1147
1129
  lines.push("");
1148
- lines.push("**Memory speichern** - Wenn der User dich bittet etwas zu merken oder wichtige Infos auftauchen:");
1149
- lines.push("```bash");
1150
- lines.push('shiva remember "Die wichtige Information die gemerkt werden soll"');
1151
- lines.push("```");
1130
+ lines.push("**SOFORT speichern wenn:**");
1152
1131
  lines.push("");
1153
- lines.push("**Memories durchsuchen** - Um gespeicherte Informationen zu finden:");
1132
+ lines.push("| Trigger | Kategorie | Beispiel |");
1133
+ lines.push("|---------|-----------|----------|");
1134
+ lines.push('| User nennt Namen/Rolle | `identity` | "Ich bin Ben, Backend-Dev" |');
1135
+ lines.push('| User hat Pr\xE4ferenz | `preference` | "Ich mag keine Kommentare im Code" |');
1136
+ lines.push('| Konvention etabliert | `convention` | "Wir nutzen immer camelCase" |');
1137
+ lines.push('| Problem gel\xF6st | `solution` | "Error X: L\xF6sung war Y" |');
1138
+ lines.push('| User korrigiert dich | `preference` | "Nein, ich meinte TypeScript" |');
1139
+ lines.push('| Architektur-Entscheidung | `convention` | "API nutzt REST, nicht GraphQL" |');
1140
+ lines.push("");
1141
+ lines.push("**Beispiele:**");
1154
1142
  lines.push("```bash");
1155
- lines.push('shiva search "suchbegriff"');
1143
+ lines.push('# User sagt "Ich bin Benjamin"');
1144
+ lines.push('shiva remember "User hei\xDFt Benjamin" --category identity');
1145
+ lines.push("");
1146
+ lines.push('# User sagt "Ich mag kurze Funktionen"');
1147
+ lines.push('shiva remember "User bevorzugt kurze Funktionen unter 20 Zeilen" --category preference');
1148
+ lines.push("");
1149
+ lines.push("# Nach Bugfix");
1150
+ lines.push('shiva remember "CORS Error: Backend braucht credentials:true" --category solution');
1151
+ lines.push("");
1152
+ lines.push("# Projekt-Konvention");
1153
+ lines.push('shiva remember "Projekt nutzt Tailwind CSS" --category convention');
1156
1154
  lines.push("```");
1157
1155
  lines.push("");
1158
- lines.push("**Wann Memories speichern:**");
1159
- lines.push('- User sagt "merk dir...", "speicher...", "erinner dich..."');
1160
- lines.push("- Wichtige Projektentscheidungen");
1161
- lines.push("- API Keys, Secrets, Konfigurationen (nutze `shiva secrets add`)");
1162
- lines.push("- Wichtige Code-Patterns oder Konventionen");
1163
- lines.push("- Alles was in zuk\xFCnftigen Sessions relevant sein k\xF6nnte");
1156
+ lines.push("#### NICHT speichern:");
1157
+ lines.push("- Code-Snippets (sind in Git)");
1158
+ lines.push('- Triviale Infos ("OK", "Ja", "Danke")');
1159
+ lines.push("- Tempor\xE4re Debug-Ausgaben");
1160
+ lines.push("- Infos die bereits in README/Docs stehen");
1161
+ lines.push("");
1162
+ lines.push("#### Bei Session-Start:");
1163
+ lines.push('F\xFChre `shiva search ""` aus um relevante Memories zu laden!');
1164
1164
  lines.push("");
1165
+ return lines;
1166
+ }
1167
+ function generateMemoriesSection(project) {
1168
+ const lines = [];
1165
1169
  lines.push("## Memories");
1166
1170
  lines.push("");
1167
1171
  if (project?.memories && project.memories.length > 0) {
1168
- lines.push("The following context is remembered across sessions:");
1172
+ lines.push("Gespeicherter Kontext aus vorherigen Sessions:");
1169
1173
  lines.push("");
1170
1174
  for (const memory of project.memories) {
1171
1175
  lines.push(`- **${memory.key}** (${memory.category}): ${memory.value}`);
1172
1176
  }
1173
1177
  } else {
1174
- lines.push("No memories stored yet. Use `shiva sync` to sync your project.");
1178
+ lines.push("Noch keine Memories gespeichert. Nutze `shiva remember` um Wissen zu speichern!");
1179
+ }
1180
+ lines.push("");
1181
+ return lines;
1182
+ }
1183
+ function generateStatusSection(project) {
1184
+ const lines = [];
1185
+ lines.push("## SHIVA Code");
1186
+ lines.push("");
1187
+ lines.push("Dieses Projekt nutzt [SHIVA Code](https://shiva.li) f\xFCr persistenten Speicher.");
1188
+ lines.push("");
1189
+ if (project) {
1190
+ lines.push(`- **Status**: ${project.synced ? "Synced" : "Pending"}`);
1191
+ if (project.last_synced_at) {
1192
+ lines.push(`- **Last Sync**: ${new Date(project.last_synced_at).toLocaleString()}`);
1193
+ }
1194
+ lines.push(`- **Project ID**: ${project.id}`);
1195
+ } else {
1196
+ lines.push("- **Status**: Not synced");
1197
+ lines.push("- **Last Sync**: Never");
1175
1198
  }
1176
1199
  lines.push("");
1200
+ return lines;
1201
+ }
1202
+ function generateClaudeMd(scanned, project) {
1203
+ const lines = [];
1204
+ lines.push(`# ${scanned.name}`);
1205
+ lines.push("");
1206
+ lines.push("## Project Overview");
1207
+ if (scanned.description) {
1208
+ lines.push(scanned.description);
1209
+ } else {
1210
+ lines.push("<!-- Add project description here -->");
1211
+ }
1212
+ lines.push("");
1213
+ lines.push("## Tech Stack");
1214
+ if (scanned.language) {
1215
+ lines.push(`- **Language**: ${scanned.language}`);
1216
+ }
1217
+ if (scanned.framework) {
1218
+ lines.push(`- **Framework**: ${scanned.framework}`);
1219
+ }
1220
+ if (scanned.packageManager) {
1221
+ lines.push(`- **Package Manager**: ${scanned.packageManager}`);
1222
+ }
1223
+ lines.push("");
1224
+ lines.push(...generateStatusSection(project));
1225
+ lines.push(...generateShivaInstructions());
1226
+ lines.push(...generateMemoriesSection(project));
1177
1227
  if (project?.connections && project.connections.length > 0) {
1178
1228
  lines.push("## Connected Projects");
1179
1229
  lines.push("");
1180
- lines.push("This project is connected to:");
1230
+ lines.push("Verbundene Projekte:");
1181
1231
  lines.push("");
1182
1232
  for (const conn of project.connections) {
1183
1233
  lines.push(`- **${conn.connected_project_name}** (${conn.connection_type})`);
@@ -1203,59 +1253,14 @@ function parseClaudeMd(content) {
1203
1253
  return { memories };
1204
1254
  }
1205
1255
  function hasShivaInstructions(content) {
1206
- return content.includes("### SHIVA Instructions") || content.includes("## SHIVA Code");
1256
+ return content.includes("### SHIVA Memory System") || content.includes("### SHIVA Instructions") || content.includes("## SHIVA Code");
1207
1257
  }
1208
1258
  function generateShivaSection(project) {
1209
1259
  const lines = [];
1210
1260
  lines.push("");
1211
- lines.push("## SHIVA Code");
1212
- lines.push("");
1213
- lines.push("This project is managed by [SHIVA Code](https://shiva.li).");
1214
- lines.push("");
1215
- if (project) {
1216
- lines.push(`- **Status**: ${project.synced ? "Synced" : "Pending"}`);
1217
- if (project.last_synced_at) {
1218
- lines.push(`- **Last Sync**: ${new Date(project.last_synced_at).toLocaleString()}`);
1219
- }
1220
- lines.push(`- **Project ID**: ${project.id}`);
1221
- } else {
1222
- lines.push("- **Status**: Not synced");
1223
- lines.push("- **Last Sync**: Never");
1224
- }
1225
- lines.push("");
1226
- lines.push("### SHIVA Instructions");
1227
- lines.push("");
1228
- lines.push("IMPORTANT: Du MUSST diese Befehle nutzen um Informationen \xFCber Sessions hinweg zu speichern!");
1229
- lines.push("");
1230
- lines.push("**Memory speichern** - Wenn der User dich bittet etwas zu merken oder wichtige Infos auftauchen:");
1231
- lines.push("```bash");
1232
- lines.push('shiva remember "Die wichtige Information die gemerkt werden soll"');
1233
- lines.push("```");
1234
- lines.push("");
1235
- lines.push("**Memories durchsuchen** - Um gespeicherte Informationen zu finden:");
1236
- lines.push("```bash");
1237
- lines.push('shiva search "suchbegriff"');
1238
- lines.push("```");
1239
- lines.push("");
1240
- lines.push("**Wann Memories speichern:**");
1241
- lines.push('- User sagt "merk dir...", "speicher...", "erinner dich..."');
1242
- lines.push("- Wichtige Projektentscheidungen");
1243
- lines.push("- API Keys, Secrets, Konfigurationen (nutze `shiva secrets add`)");
1244
- lines.push("- Wichtige Code-Patterns oder Konventionen");
1245
- lines.push("- Alles was in zuk\xFCnftigen Sessions relevant sein k\xF6nnte");
1246
- lines.push("");
1247
- lines.push("## Memories");
1248
- lines.push("");
1249
- if (project?.memories && project.memories.length > 0) {
1250
- lines.push("The following context is remembered across sessions:");
1251
- lines.push("");
1252
- for (const memory of project.memories) {
1253
- lines.push(`- **${memory.key}** (${memory.category}): ${memory.value}`);
1254
- }
1255
- } else {
1256
- lines.push("No memories stored yet. Use `shiva sync` to sync your project.");
1257
- }
1258
- lines.push("");
1261
+ lines.push(...generateStatusSection(project));
1262
+ lines.push(...generateShivaInstructions());
1263
+ lines.push(...generateMemoriesSection(project));
1259
1264
  lines.push("---");
1260
1265
  lines.push("");
1261
1266
  lines.push("*Generated by SHIVA Code CLI*");
@@ -12588,7 +12593,8 @@ async function handlePreview(filepath) {
12588
12593
 
12589
12594
  // src/commands/memory/remember.ts
12590
12595
  import { Command as Command27 } from "commander";
12591
- var rememberCommand = new Command27("remember").description("Memory in der Cloud speichern").argument("<text>", "Der Text der gespeichert werden soll").option("-t, --title <title>", "Titel f\xFCr die Memory").option("-g, --global", "Global speichern (nicht projektgebunden)").option("--tags <tags>", "Komma-separierte Tags").action(async (text, options) => {
12596
+ var VALID_CATEGORIES = ["identity", "preference", "convention", "solution", "task", "context", "general"];
12597
+ var rememberCommand = new Command27("remember").description("Memory in der Cloud speichern").argument("<text>", "Der Text der gespeichert werden soll").option("-t, --title <title>", "Titel f\xFCr die Memory").option("-c, --category <category>", "Kategorie: identity, preference, convention, solution, task, context, general", "general").option("-g, --global", "Global speichern (nicht projektgebunden)").option("--tags <tags>", "Komma-separierte Tags").option("--ttl <days>", "Time-to-live in Tagen (auto-delete nach Ablauf)").action(async (text, options) => {
12592
12598
  if (!isAuthenticated()) {
12593
12599
  log.error("Nicht angemeldet");
12594
12600
  log.info("Anmelden mit: shiva login");
@@ -12596,22 +12602,38 @@ var rememberCommand = new Command27("remember").description("Memory in der Cloud
12596
12602
  }
12597
12603
  const projectPath = process.cwd();
12598
12604
  const config = getProjectConfig(projectPath);
12605
+ const category = options.category?.toLowerCase();
12606
+ if (!VALID_CATEGORIES.includes(category)) {
12607
+ log.error(`Ung\xFCltige Kategorie: ${options.category}`);
12608
+ log.info(`G\xFCltige Kategorien: ${VALID_CATEGORIES.join(", ")}`);
12609
+ return;
12610
+ }
12599
12611
  let projectId = null;
12600
12612
  if (!options.global && config.projectId) {
12601
12613
  projectId = config.projectId;
12602
12614
  }
12603
12615
  const title = options.title || text.substring(0, 100);
12604
12616
  const tags = options.tags ? options.tags.split(",").map((t) => t.trim()).filter(Boolean) : [];
12617
+ if (!tags.includes(category)) {
12618
+ tags.push(category);
12619
+ }
12620
+ const ttlDays = options.ttl ? parseInt(options.ttl, 10) : void 0;
12605
12621
  try {
12606
12622
  const result = await api.createMemory({
12607
12623
  title,
12608
12624
  content: text,
12609
12625
  projectId,
12610
- tags
12626
+ tags,
12627
+ category,
12628
+ ttlDays
12611
12629
  });
12612
12630
  if (result.success) {
12613
12631
  log.success("Memory gespeichert!");
12614
12632
  log.dim(`ID: ${result.memoryId}`);
12633
+ log.dim(`Kategorie: ${category}`);
12634
+ if (ttlDays) {
12635
+ log.dim(`TTL: ${ttlDays} Tage`);
12636
+ }
12615
12637
  if (projectId) {
12616
12638
  log.dim(`Projekt: ${config.projectName || projectId}`);
12617
12639
  } else {
@@ -16130,7 +16152,7 @@ sandboxCommand.command("delete <id>").description("Sandbox l\xF6schen").option("
16130
16152
 
16131
16153
  // src/index.ts
16132
16154
  var program = new Command39();
16133
- program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.6.5");
16155
+ program.name("shiva").description("SHIVA Code - Control Station for Claude Code").version("0.7.0");
16134
16156
  program.addCommand(loginCommand);
16135
16157
  program.addCommand(logoutCommand);
16136
16158
  program.addCommand(sessionsCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shiva-code",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "description": "Makes Claude Code Persistent - Cross-Project Memory CLI",
5
5
  "author": "SHIVA AI",
6
6
  "license": "MIT",