kodingo-cli 1.0.23 → 1.0.24
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/dist/commands/init.js +16 -1
- package/dist/commands/scan-repo.js +9 -3
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -56,6 +56,20 @@ 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");
|
|
59
|
+
// ── Machine ID ────────────────────────────────────────────────────────────────
|
|
60
|
+
function generateMachineId() {
|
|
61
|
+
const raw = `${os.hostname()}::${os.userInfo().username}::${process.platform}`;
|
|
62
|
+
return require("crypto").createHash("sha256").update(raw).digest("hex").slice(0, 32);
|
|
63
|
+
}
|
|
64
|
+
function getMachineId() {
|
|
65
|
+
const config = (0, persistence_config_1.readConfig)();
|
|
66
|
+
if (config.machineId)
|
|
67
|
+
return config.machineId;
|
|
68
|
+
const machineId = generateMachineId();
|
|
69
|
+
const existing = (0, persistence_config_1.readConfig)();
|
|
70
|
+
(0, persistence_config_1.writeConfig)({ ...existing, machineId });
|
|
71
|
+
return machineId;
|
|
72
|
+
}
|
|
59
73
|
// ── Auth token storage ────────────────────────────────────────────────────────
|
|
60
74
|
function readAuthToken() {
|
|
61
75
|
try {
|
|
@@ -255,7 +269,8 @@ function registerInitCommand(program) {
|
|
|
255
269
|
const apiUrl = API_BASE;
|
|
256
270
|
// preserve existing workspaces, never overwrite global token
|
|
257
271
|
const existingConfig = (0, persistence_config_1.readConfig)();
|
|
258
|
-
|
|
272
|
+
const machineId = getMachineId();
|
|
273
|
+
(0, persistence_config_1.writeConfig)({ ...existingConfig, mode: "cloud", apiUrl, machineId });
|
|
259
274
|
(0, persistence_config_1.writeWorkspaceConfig)(repoRoot, { mode: "cloud", apiUrl, token: selectedProject.token });
|
|
260
275
|
ensureGitignoreEntry(repoRoot, ".kortex/");
|
|
261
276
|
console.log(`✔ Connected. Token saved to ${persistence_config_1.CONFIG_PATH}`);
|
|
@@ -38,7 +38,7 @@ const IGNORED_DIRS = [
|
|
|
38
38
|
"node_modules", ".git", ".kortex", "dist", "build",
|
|
39
39
|
"out", ".next", "coverage", "__pycache__", "vendor",
|
|
40
40
|
];
|
|
41
|
-
const MAX_SYMBOLS =
|
|
41
|
+
const MAX_SYMBOLS = 200;
|
|
42
42
|
const BATCH_SIZE = 5;
|
|
43
43
|
const BATCH_DELAY_MS = 1200;
|
|
44
44
|
function findRepoRoot(startPath) {
|
|
@@ -107,8 +107,12 @@ async function fetchExistingSymbols(token, repo) {
|
|
|
107
107
|
break;
|
|
108
108
|
const data = await res.json();
|
|
109
109
|
for (const m of data.memories ?? []) {
|
|
110
|
-
if (m.symbol)
|
|
110
|
+
if (m.symbol) {
|
|
111
|
+
// Store both symbol-only and symbol::repo keys for accurate matching
|
|
111
112
|
known.add(m.symbol);
|
|
113
|
+
if (m.repo)
|
|
114
|
+
known.add(`${m.symbol}::${m.repo}`);
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
offset += limit;
|
|
114
118
|
if (offset >= (data.total ?? 0))
|
|
@@ -195,7 +199,9 @@ async function scanRepoCommand(options = {}) {
|
|
|
195
199
|
if (seen.has(key))
|
|
196
200
|
continue;
|
|
197
201
|
seen.add(key);
|
|
198
|
-
|
|
202
|
+
const symRepoKey = `${sym.name}::${path_1.default.basename(sym.file)}`;
|
|
203
|
+
const hasMemory = existingSymbols.has(symRepoKey) || existingSymbols.has(sym.name);
|
|
204
|
+
if (!hasMemory)
|
|
199
205
|
toCapture.push(sym);
|
|
200
206
|
}
|
|
201
207
|
if (toCapture.length === 0) {
|