@ulpi/codemap 0.3.3 → 0.3.5
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/index.js +55 -9
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -5758,8 +5758,7 @@ function registerInit(program2) {
|
|
|
5758
5758
|
console.log(` Model: ${chalk3.cyan(config.embedding.model)}`);
|
|
5759
5759
|
console.log(` Dimensions: ${chalk3.cyan(String(config.embedding.dimensions))}`);
|
|
5760
5760
|
if (config.embedding.apiKey) {
|
|
5761
|
-
|
|
5762
|
-
console.log(` API key: ${chalk3.cyan(masked)}`);
|
|
5761
|
+
console.log(` API key: ${chalk3.green("configured")}`);
|
|
5763
5762
|
}
|
|
5764
5763
|
console.log();
|
|
5765
5764
|
const answer = await ask("Reconfigure? (y/N): ");
|
|
@@ -5794,11 +5793,30 @@ function registerInit(program2) {
|
|
|
5794
5793
|
console.log();
|
|
5795
5794
|
const hasAccount = await ask("Do you have a ULPI account? (y/n): ");
|
|
5796
5795
|
if (hasAccount.toLowerCase() === "y") {
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
console.log(
|
|
5796
|
+
console.log();
|
|
5797
|
+
const email = await ask("Email: ");
|
|
5798
|
+
const password = await askSecret("Password: ");
|
|
5799
|
+
try {
|
|
5800
|
+
console.log();
|
|
5801
|
+
console.log(chalk3.dim("Logging in..."));
|
|
5802
|
+
const token = await ulpiLogin(email, password);
|
|
5803
|
+
console.log(chalk3.green("Logged in."));
|
|
5804
|
+
console.log(chalk3.dim("Fetching API keys..."));
|
|
5805
|
+
const existingKey = await ulpiGetKey(token);
|
|
5806
|
+
if (existingKey) {
|
|
5807
|
+
config.embedding.apiKey = existingKey;
|
|
5808
|
+
console.log(chalk3.green("API key configured."));
|
|
5809
|
+
} else {
|
|
5810
|
+
console.log(chalk3.dim("No existing key found. Creating one..."));
|
|
5811
|
+
const apiKey = await ulpiCreateKey(token);
|
|
5812
|
+
config.embedding.apiKey = apiKey;
|
|
5813
|
+
console.log(chalk3.green("API key configured."));
|
|
5814
|
+
}
|
|
5815
|
+
} catch (err) {
|
|
5816
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
5817
|
+
console.error(chalk3.red(`Login failed: ${msg}`));
|
|
5818
|
+
console.log();
|
|
5819
|
+
console.log(chalk3.yellow("You can set the API key manually later:"));
|
|
5802
5820
|
console.log(chalk3.dim(" codemap config set embedding.apiKey <key>"));
|
|
5803
5821
|
}
|
|
5804
5822
|
} else {
|
|
@@ -5821,7 +5839,7 @@ function registerInit(program2) {
|
|
|
5821
5839
|
console.log(chalk3.dim("Creating API key..."));
|
|
5822
5840
|
const apiKey = await ulpiCreateKey(token);
|
|
5823
5841
|
config.embedding.apiKey = apiKey;
|
|
5824
|
-
console.log(chalk3.green("API key
|
|
5842
|
+
console.log(chalk3.green("API key configured."));
|
|
5825
5843
|
} catch (err) {
|
|
5826
5844
|
const msg = err instanceof Error ? err.message : String(err);
|
|
5827
5845
|
console.error(chalk3.red(`Registration failed: ${msg}`));
|
|
@@ -6021,6 +6039,34 @@ async function ulpiRegister(name, email, password) {
|
|
|
6021
6039
|
}
|
|
6022
6040
|
return json2.token;
|
|
6023
6041
|
}
|
|
6042
|
+
async function ulpiLogin(email, password) {
|
|
6043
|
+
const form = new URLSearchParams();
|
|
6044
|
+
form.set("email", email);
|
|
6045
|
+
form.set("password", password);
|
|
6046
|
+
const res = await fetch(`${ULPI_AUTH_BASE}/login`, {
|
|
6047
|
+
method: "POST",
|
|
6048
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json" },
|
|
6049
|
+
body: form
|
|
6050
|
+
});
|
|
6051
|
+
const json2 = await res.json();
|
|
6052
|
+
if (!res.ok || !json2.token) {
|
|
6053
|
+
if (json2.errors) {
|
|
6054
|
+
const msgs = Object.values(json2.errors).flat();
|
|
6055
|
+
throw new Error(msgs.join(", "));
|
|
6056
|
+
}
|
|
6057
|
+
throw new Error(json2.message ?? `HTTP ${res.status}`);
|
|
6058
|
+
}
|
|
6059
|
+
return json2.token;
|
|
6060
|
+
}
|
|
6061
|
+
async function ulpiGetKey(token) {
|
|
6062
|
+
const res = await fetch(`${ULPI_AUTH_BASE}/keys`, {
|
|
6063
|
+
method: "GET",
|
|
6064
|
+
headers: { "Accept": "application/json", "Authorization": `Bearer ${token}` }
|
|
6065
|
+
});
|
|
6066
|
+
const json2 = await res.json();
|
|
6067
|
+
if (!res.ok || !json2.data?.length) return null;
|
|
6068
|
+
return json2.data[0].key ?? null;
|
|
6069
|
+
}
|
|
6024
6070
|
async function ulpiCreateKey(token) {
|
|
6025
6071
|
const form = new URLSearchParams();
|
|
6026
6072
|
form.set("name", "codemap-cli");
|
|
@@ -6969,7 +7015,7 @@ var __dirname = path13.dirname(fileURLToPath(import.meta.url));
|
|
|
6969
7015
|
var grammarsDir = path13.join(__dirname, "grammars");
|
|
6970
7016
|
setGrammarDir(grammarsDir);
|
|
6971
7017
|
var program = new Command();
|
|
6972
|
-
program.name("codemap").description("Code intelligence CLI \u2014 hybrid search, dependency analysis, PageRank").version("0.3.
|
|
7018
|
+
program.name("codemap").description("Code intelligence CLI \u2014 hybrid search, dependency analysis, PageRank").version("0.3.5").option("--cwd <dir>", "Project directory (default: cwd)");
|
|
6973
7019
|
registerSearch(program);
|
|
6974
7020
|
registerSymbols(program);
|
|
6975
7021
|
registerIndex(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ulpi/codemap",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Standalone code intelligence CLI — hybrid vector + BM25 search, dependency analysis, PageRank",
|
|
6
6
|
"bin": {
|
|
@@ -20,11 +20,6 @@
|
|
|
20
20
|
"lint": "eslint src/"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@ulpi/codemap-engine": "workspace:*",
|
|
24
|
-
"@ulpi/depgraph-engine": "workspace:*",
|
|
25
|
-
"@ulpi/embed-engine": "workspace:*",
|
|
26
|
-
"@ulpi/config": "workspace:*",
|
|
27
|
-
"@ulpi/contracts": "workspace:*",
|
|
28
23
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
29
24
|
"@lancedb/lancedb": "^0.15.0",
|
|
30
25
|
"commander": "^13.0.0",
|
|
@@ -34,6 +29,11 @@
|
|
|
34
29
|
"zod": "^3.24.0"
|
|
35
30
|
},
|
|
36
31
|
"devDependencies": {
|
|
32
|
+
"@ulpi/codemap-engine": "workspace:*",
|
|
33
|
+
"@ulpi/depgraph-engine": "workspace:*",
|
|
34
|
+
"@ulpi/embed-engine": "workspace:*",
|
|
35
|
+
"@ulpi/config": "workspace:*",
|
|
36
|
+
"@ulpi/contracts": "workspace:*",
|
|
37
37
|
"tree-sitter-c": "^0.24.1",
|
|
38
38
|
"tree-sitter-cpp": "^0.23.4",
|
|
39
39
|
"tree-sitter-css": "^0.25.0",
|