kodingo-cli 1.0.17 → 1.0.18

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inferDecisionSummary = inferDecisionSummary;
4
4
  exports.inferMemoryFromCode = inferMemoryFromCode;
5
- const KODINGO_API_URL = process.env.KODINGO_API_URL ?? "https://api.kodingo.xyz";
5
+ const KODINGO_API_URL = process.env.KODINGO_API_URL ?? "https://kodingo-api.onrender.com";
6
6
  async function inferDecisionSummary(input) {
7
7
  try {
8
8
  const code = input.diff.slice(0, 2000);
@@ -52,7 +52,7 @@ const path = __importStar(require("path"));
52
52
  const os = __importStar(require("os"));
53
53
  const open_1 = __importDefault(require("open"));
54
54
  const persistence_config_1 = require("../utils/persistence-config");
55
- const API_BASE = "https://api.kodingo.xyz";
55
+ const API_BASE = "https://kodingo-api.onrender.com";
56
56
  const APP_URL = "https://kodingo.xyz";
57
57
  const CONFIG_DIR = path.join(os.homedir(), ".kodingo");
58
58
  const AUTH_TOKEN_PATH = path.join(CONFIG_DIR, "auth.json");
@@ -20,7 +20,7 @@ exports.scanRepoCommand = scanRepoCommand;
20
20
  const fs_1 = __importDefault(require("fs"));
21
21
  const path_1 = __importDefault(require("path"));
22
22
  const persistence_config_1 = require("../utils/persistence-config");
23
- const API_BASE = "https://api.kodingo.xyz";
23
+ const API_BASE = "https://kodingo-api.onrender.com";
24
24
  const SUPPORTED_EXTENSIONS = [
25
25
  ".ts", ".tsx", ".js", ".jsx",
26
26
  ".py", ".go", ".rs", ".php",
@@ -96,18 +96,27 @@ function extractSymbols(filePath) {
96
96
  return [];
97
97
  }
98
98
  }
99
- async function hasExistingMemory(token, symbol, repo) {
99
+ async function fetchExistingSymbols(token, repo) {
100
+ const known = new Set();
101
+ let offset = 0;
102
+ const limit = 200;
100
103
  try {
101
- const res = await fetch(`${API_BASE}/memory?symbol=${encodeURIComponent(symbol)}&repo=${encodeURIComponent(repo)}&limit=1`, { headers: { "X-Kodingo-Token": token } });
102
- if (!res.ok)
103
- return false;
104
- const data = await res.json();
105
- // Must match exact symbol name
106
- return (data.total ?? 0) > 0 && (data.memories ?? []).some(m => m.symbol === symbol);
107
- }
108
- catch {
109
- return false;
104
+ while (true) {
105
+ const res = await fetch(`${API_BASE}/memory?repo=${encodeURIComponent(repo)}&limit=${limit}&offset=${offset}`, { headers: { "X-Kodingo-Token": token } });
106
+ if (!res.ok)
107
+ break;
108
+ const data = await res.json();
109
+ for (const m of data.memories ?? []) {
110
+ if (m.symbol)
111
+ known.add(m.symbol);
112
+ }
113
+ offset += limit;
114
+ if (offset >= (data.total ?? 0))
115
+ break;
116
+ }
110
117
  }
118
+ catch { }
119
+ return known;
111
120
  }
112
121
  async function inferAndCapture(token, symbol, repo) {
113
122
  try {
@@ -168,21 +177,21 @@ async function scanRepoCommand(options = {}) {
168
177
  console.log(` Found ${allSymbols.length} functions across ${files.length} files`);
169
178
  console.log(` Checking which ones need memory...\n`);
170
179
  }
180
+ // Fetch all existing memory symbols in one bulk call
181
+ const existingSymbols = await fetchExistingSymbols(config.token, repoName);
171
182
  // Shuffle so repeated runs cover different parts of the codebase
172
183
  const shuffled = [...allSymbols].sort(() => Math.random() - 0.5);
173
- // Filter to symbols without existing memory, cap at MAX_SYMBOLS
184
+ // Filter locally no per-symbol API calls needed
174
185
  const toCapture = [];
175
186
  const seen = new Set();
176
187
  for (const sym of shuffled) {
177
188
  if (toCapture.length >= MAX_SYMBOLS)
178
189
  break;
179
- // Deduplicate by symbol+file to avoid capturing the same function twice
180
190
  const key = `${sym.name}::${sym.file}`;
181
191
  if (seen.has(key))
182
192
  continue;
183
193
  seen.add(key);
184
- const exists = await hasExistingMemory(config.token, sym.name, repoName);
185
- if (!exists)
194
+ if (!existingSymbols.has(sym.name))
186
195
  toCapture.push(sym);
187
196
  }
188
197
  if (toCapture.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodingo-cli",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Kodingo CLI",
5
5
  "license": "MIT",
6
6
  "private": false,