kodingo-cli 1.0.16 → 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,17 +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
- return (data.total ?? 0) > 0;
106
- }
107
- catch {
108
- 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
+ }
109
117
  }
118
+ catch { }
119
+ return known;
110
120
  }
111
121
  async function inferAndCapture(token, symbol, repo) {
112
122
  try {
@@ -167,13 +177,21 @@ async function scanRepoCommand(options = {}) {
167
177
  console.log(` Found ${allSymbols.length} functions across ${files.length} files`);
168
178
  console.log(` Checking which ones need memory...\n`);
169
179
  }
170
- // Filter to symbols without existing memory, cap at MAX_SYMBOLS
180
+ // Fetch all existing memory symbols in one bulk call
181
+ const existingSymbols = await fetchExistingSymbols(config.token, repoName);
182
+ // Shuffle so repeated runs cover different parts of the codebase
183
+ const shuffled = [...allSymbols].sort(() => Math.random() - 0.5);
184
+ // Filter locally — no per-symbol API calls needed
171
185
  const toCapture = [];
172
- for (const sym of allSymbols) {
186
+ const seen = new Set();
187
+ for (const sym of shuffled) {
173
188
  if (toCapture.length >= MAX_SYMBOLS)
174
189
  break;
175
- const exists = await hasExistingMemory(config.token, sym.name, repoName);
176
- if (!exists)
190
+ const key = `${sym.name}::${sym.file}`;
191
+ if (seen.has(key))
192
+ continue;
193
+ seen.add(key);
194
+ if (!existingSymbols.has(sym.name))
177
195
  toCapture.push(sym);
178
196
  }
179
197
  if (toCapture.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodingo-cli",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Kodingo CLI",
5
5
  "license": "MIT",
6
6
  "private": false,