@ulpi/cli 0.1.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.
- package/LICENSE +21 -0
- package/README.md +200 -0
- package/dist/auth-PN7TMQHV-2W4ICG64.js +15 -0
- package/dist/chunk-247GVVKK.js +2259 -0
- package/dist/chunk-2CLNOKPA.js +793 -0
- package/dist/chunk-2HEE5OKX.js +79 -0
- package/dist/chunk-2MZER6ND.js +415 -0
- package/dist/chunk-3SBPZRB5.js +772 -0
- package/dist/chunk-4VNS5WPM.js +42 -0
- package/dist/chunk-6JCMYYBT.js +1546 -0
- package/dist/chunk-6OCEY7JY.js +422 -0
- package/dist/chunk-74WVVWJ4.js +375 -0
- package/dist/chunk-7AL4DOEJ.js +131 -0
- package/dist/chunk-7LXY5UVC.js +330 -0
- package/dist/chunk-DBMUNBNB.js +3048 -0
- package/dist/chunk-JWUUVXIV.js +13694 -0
- package/dist/chunk-KIKPIH6N.js +4048 -0
- package/dist/chunk-KLEASXUR.js +70 -0
- package/dist/chunk-MIAQVCFW.js +39 -0
- package/dist/chunk-NNUWU6CV.js +1610 -0
- package/dist/chunk-PKD4ASEM.js +115 -0
- package/dist/chunk-Q4HIY43N.js +4230 -0
- package/dist/chunk-QJ5GSMEC.js +146 -0
- package/dist/chunk-SIAQVRKG.js +2163 -0
- package/dist/chunk-SPOI23SB.js +197 -0
- package/dist/chunk-YM2HV4IA.js +505 -0
- package/dist/codemap-RRJIDBQ5.js +636 -0
- package/dist/config-EGAXXCGL.js +127 -0
- package/dist/dist-6G7JC2RA.js +90 -0
- package/dist/dist-7LHZ65GC.js +418 -0
- package/dist/dist-LZKZFPVX.js +140 -0
- package/dist/dist-R5F4MX3I.js +107 -0
- package/dist/dist-R5ZJ4LX5.js +56 -0
- package/dist/dist-RJGCUS3L.js +87 -0
- package/dist/dist-RKOGLK7R.js +151 -0
- package/dist/dist-W7K4WPAF.js +597 -0
- package/dist/export-import-4A5MWLIA.js +53 -0
- package/dist/history-ATTUKOHO.js +934 -0
- package/dist/index.js +2120 -0
- package/dist/init-AY5C2ZAS.js +393 -0
- package/dist/launchd-LF2QMSKZ.js +148 -0
- package/dist/log-TVTUXAYD.js +75 -0
- package/dist/mcp-installer-NQCGKQ23.js +124 -0
- package/dist/memory-J3G24QHS.js +406 -0
- package/dist/ollama-3XCUZMZT-FYKHW4TZ.js +7 -0
- package/dist/openai-E7G2YAHU-UYY4ZWON.js +8 -0
- package/dist/projects-ATHDD3D6.js +271 -0
- package/dist/review-ADUPV3PN.js +152 -0
- package/dist/rules-E427DKYJ.js +134 -0
- package/dist/server-MOYPE4SM-N7SE2AN7.js +18 -0
- package/dist/server-X5P6WH2M-7K2RY34N.js +11 -0
- package/dist/skills/ulpi-generate-guardian/SKILL.md +511 -0
- package/dist/skills/ulpi-generate-guardian/references/framework-rules.md +692 -0
- package/dist/skills/ulpi-generate-guardian/references/language-rules.md +596 -0
- package/dist/skills-CX73O3IV.js +76 -0
- package/dist/status-4DFHDJMN.js +66 -0
- package/dist/templates/biome.yml +24 -0
- package/dist/templates/conventional-commits.yml +18 -0
- package/dist/templates/django.yml +30 -0
- package/dist/templates/docker.yml +30 -0
- package/dist/templates/eslint.yml +13 -0
- package/dist/templates/express.yml +20 -0
- package/dist/templates/fastapi.yml +23 -0
- package/dist/templates/git-flow.yml +26 -0
- package/dist/templates/github-flow.yml +27 -0
- package/dist/templates/go.yml +33 -0
- package/dist/templates/jest.yml +24 -0
- package/dist/templates/laravel.yml +30 -0
- package/dist/templates/monorepo.yml +26 -0
- package/dist/templates/nestjs.yml +21 -0
- package/dist/templates/nextjs.yml +31 -0
- package/dist/templates/nodejs.yml +33 -0
- package/dist/templates/npm.yml +15 -0
- package/dist/templates/php.yml +25 -0
- package/dist/templates/pnpm.yml +15 -0
- package/dist/templates/prettier.yml +23 -0
- package/dist/templates/prisma.yml +21 -0
- package/dist/templates/python.yml +33 -0
- package/dist/templates/quality-of-life.yml +111 -0
- package/dist/templates/ruby.yml +25 -0
- package/dist/templates/rust.yml +34 -0
- package/dist/templates/typescript.yml +14 -0
- package/dist/templates/vitest.yml +24 -0
- package/dist/templates/yarn.yml +15 -0
- package/dist/templates-U7T6MARD.js +156 -0
- package/dist/ui-L7UAWXDY.js +167 -0
- package/dist/ui.html +698 -0
- package/dist/ulpi-RMMCUAGP-JCJ273T6.js +161 -0
- package/dist/uninstall-6SW35IK4.js +25 -0
- package/dist/update-M2B4RLGH.js +61 -0
- package/dist/version-checker-ANCS3IHR.js +10 -0
- package/package.json +92 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// ../../packages/codemap-engine/dist/chunk-RU4VHMIP.js
|
|
2
|
+
var DEFAULT_OLLAMA_URL = "http://localhost:11434";
|
|
3
|
+
var MAX_RETRIES = 3;
|
|
4
|
+
var RETRY_BASE_MS = 500;
|
|
5
|
+
var OllamaEmbedder = class {
|
|
6
|
+
provider = "ollama";
|
|
7
|
+
model;
|
|
8
|
+
dimensions;
|
|
9
|
+
baseUrl;
|
|
10
|
+
constructor(model = "nomic-embed-text", dimensions = 768) {
|
|
11
|
+
this.model = model;
|
|
12
|
+
this.dimensions = dimensions;
|
|
13
|
+
this.baseUrl = process.env.OLLAMA_HOST ?? DEFAULT_OLLAMA_URL;
|
|
14
|
+
}
|
|
15
|
+
async embed(texts) {
|
|
16
|
+
if (texts.length === 0) return [];
|
|
17
|
+
const results = [];
|
|
18
|
+
for (const text of texts) {
|
|
19
|
+
const embedding = await this.embedSingle(text);
|
|
20
|
+
results.push(embedding);
|
|
21
|
+
}
|
|
22
|
+
return results;
|
|
23
|
+
}
|
|
24
|
+
async embedSingle(text) {
|
|
25
|
+
let lastError = null;
|
|
26
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(`${this.baseUrl}/api/embed`, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
body: JSON.stringify({ model: this.model, input: text })
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const errorText = await response.text();
|
|
35
|
+
lastError = new Error(`Ollama API error (${response.status}): ${errorText.slice(0, 200)}`);
|
|
36
|
+
if (response.status >= 500) {
|
|
37
|
+
const delay = RETRY_BASE_MS * Math.pow(2, attempt);
|
|
38
|
+
await sleep(delay);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
throw lastError;
|
|
42
|
+
}
|
|
43
|
+
const data = await response.json();
|
|
44
|
+
if (!data.embeddings || data.embeddings.length === 0) {
|
|
45
|
+
throw new Error("Ollama returned empty embeddings");
|
|
46
|
+
}
|
|
47
|
+
return data.embeddings[0];
|
|
48
|
+
} catch (err) {
|
|
49
|
+
if (err instanceof Error && err.message.includes("fetch")) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`Cannot connect to Ollama at ${this.baseUrl}. Is Ollama running? Start it with: ollama serve`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
55
|
+
if (attempt < MAX_RETRIES - 1) {
|
|
56
|
+
const delay = RETRY_BASE_MS * Math.pow(2, attempt);
|
|
57
|
+
await sleep(delay);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
throw lastError ?? new Error("Ollama embedding failed after retries");
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function sleep(ms) {
|
|
65
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
OllamaEmbedder
|
|
70
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// ../api/dist/chunk-UOFEIZ6Y.js
|
|
2
|
+
import { randomBytes } from "crypto";
|
|
3
|
+
var apiSecret;
|
|
4
|
+
function generateApiSecret() {
|
|
5
|
+
return randomBytes(32).toString("hex");
|
|
6
|
+
}
|
|
7
|
+
function setApiSecret(secret) {
|
|
8
|
+
apiSecret = secret;
|
|
9
|
+
}
|
|
10
|
+
function getApiSecret() {
|
|
11
|
+
return apiSecret;
|
|
12
|
+
}
|
|
13
|
+
function validateLoopback(req) {
|
|
14
|
+
const remoteAddr = req.socket.remoteAddress ?? "";
|
|
15
|
+
return remoteAddr === "127.0.0.1" || remoteAddr === "::1" || remoteAddr === "::ffff:127.0.0.1";
|
|
16
|
+
}
|
|
17
|
+
function validateAuth(req) {
|
|
18
|
+
if (!validateLoopback(req)) return false;
|
|
19
|
+
if (apiSecret) {
|
|
20
|
+
const headerSecret = req.headers["x-ulpi-secret"];
|
|
21
|
+
if (headerSecret === apiSecret) return true;
|
|
22
|
+
try {
|
|
23
|
+
const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
|
|
24
|
+
const paramSecret = url.searchParams.get("secret");
|
|
25
|
+
if (paramSecret === apiSecret) return true;
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
generateApiSecret,
|
|
35
|
+
setApiSecret,
|
|
36
|
+
getApiSecret,
|
|
37
|
+
validateLoopback,
|
|
38
|
+
validateAuth
|
|
39
|
+
};
|