@ulpi/cli 0.1.4 → 0.1.6
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/dist/{auth-PN7TMQHV-2W4ICG64.js → auth-FWM7MM4Q-VZC3U2XZ.js} +1 -1
- package/dist/{auth-ECQ3IB4E.js → auth-HDK7ECJL.js} +2 -1
- package/dist/{chunk-3SBPZRB5.js → chunk-3BCW6ABU.js} +402 -142
- package/dist/{chunk-JGBXM5NC.js → chunk-3WB5CXH4.js} +180 -5
- package/dist/{chunk-2HEE5OKX.js → chunk-4UCJIAOU.js} +2 -2
- package/dist/chunk-4XTHZVDS.js +109 -0
- package/dist/chunk-4ZPOZULQ.js +6522 -0
- package/dist/{chunk-SIAQVRKG.js → chunk-5MI5GIXM.js} +48 -2
- package/dist/{chunk-KLEASXUR.js → chunk-6ZL6NXMV.js} +1 -1
- package/dist/chunk-76D3BYJD.js +221 -0
- package/dist/{chunk-ZLYRPD7I.js → chunk-AWOSRA5F.js} +1 -1
- package/dist/{chunk-PDR55ZNW.js → chunk-BFEKZZHM.js} +274 -57
- package/dist/chunk-C7CLUQI6.js +1286 -0
- package/dist/{chunk-7AL4DOEJ.js → chunk-E3B5NROU.js} +7 -7
- package/dist/chunk-EJ7TW77N.js +1418 -0
- package/dist/{chunk-5J6NLQUN.js → chunk-IV6MWETF.js} +383 -168
- package/dist/chunk-IZPJHSPX.js +1478 -0
- package/dist/chunk-JLHNLM3C.js +228 -0
- package/dist/{chunk-BZL5H4YQ.js → chunk-KYYI23AQ.js} +2 -2
- package/dist/{chunk-2CLNOKPA.js → chunk-RSFJ6QSR.js} +18 -0
- package/dist/chunk-S6ANCSYO.js +1271 -0
- package/dist/chunk-SEU7WWNQ.js +1251 -0
- package/dist/chunk-SNQ7NAIS.js +453 -0
- package/dist/{ulpi-RMMCUAGP-JCJ273T6.js → chunk-TSLDGT5O.js} +73 -35
- package/dist/{chunk-SPOI23SB.js → chunk-UXHCHOWQ.js} +83 -62
- package/dist/chunk-V2H5D6Y3.js +146 -0
- package/dist/{chunk-QJ5GSMEC.js → chunk-VVEDXI7E.js} +2 -1
- package/dist/chunk-VXH5Y4FO.js +6761 -0
- package/dist/chunk-WED4LM5N.js +322 -0
- package/dist/{chunk-74WVVWJ4.js → chunk-YOKL7RB5.js} +184 -15
- package/dist/chunk-Z53CAR7G.js +298 -0
- package/dist/ci-X3U2W4HC.js +854 -0
- package/dist/cloud-2F3NLVHN.js +274 -0
- package/dist/{codemap-RKSD4MIE.js → codemap-XNGMAF3F.js} +37 -37
- package/dist/codex-MB5YTMRT.js +132 -0
- package/dist/{config-EGAXXCGL.js → config-OOELBYTH.js} +1 -1
- package/dist/dist-2BJYR5EI.js +59 -0
- package/dist/dist-2K7IEVTA.js +43 -0
- package/dist/dist-3EIQTZHT.js +1380 -0
- package/dist/{dist-YA2BWZB2.js → dist-4U5L2X2C.js} +2 -2
- package/dist/{dist-UKMCJBB2.js → dist-54KAMNLO.js} +16 -15
- package/dist/dist-6M4MZWZW.js +58 -0
- package/dist/dist-6X576SU2.js +27 -0
- package/dist/dist-7QOEYLFX.js +103 -0
- package/dist/dist-AYBGHEDY.js +2541 -0
- package/dist/dist-EK45QNEM.js +45 -0
- package/dist/{dist-CS2VKNYS.js → dist-FKFEJRPX.js} +16 -15
- package/dist/dist-GTEJUBBT.js +66 -0
- package/dist/dist-HA74OKJZ.js +40 -0
- package/dist/dist-HU5RZAON.js +48 -0
- package/dist/dist-IYE3OBRB.js +374 -0
- package/dist/{dist-GJYT2OQV.js → dist-JLU26AB6.js} +12 -9
- package/dist/{dist-6G7JC2RA.js → dist-KUCI6JFE.js} +49 -9
- package/dist/dist-NUEMFZFL.js +33 -0
- package/dist/{dist-RKOGLK7R.js → dist-NUXMDXZ3.js} +31 -3
- package/dist/{dist-QAU3LGJN.js → dist-YCNWHSLN.js} +15 -5
- package/dist/{dist-CB5D5LMO.js → dist-YFFG2ZD6.js} +9 -16
- package/dist/dist-ZG4OKCSR.js +15 -0
- package/dist/doctor-SI4LLLDZ.js +345 -0
- package/dist/{export-import-4A5MWLIA.js → export-import-JFQH4KSJ.js} +1 -1
- package/dist/{history-3MOBX4MA.js → history-5NE46ZAH.js} +7 -7
- package/dist/hooks-installer-UN5JZLDQ.js +19 -0
- package/dist/index.js +395 -619
- package/dist/{init-6CH4HV5T.js → init-5FK3VKRT.js} +79 -13
- package/dist/job-HIDMAFW2.js +376 -0
- package/dist/jobs.memory-PLMMSFHB-VBECCTHN.js +33 -0
- package/dist/kiro-VMUHDFGK.js +153 -0
- package/dist/{launchd-LF2QMSKZ.js → launchd-6AWT54HR.js} +9 -17
- package/dist/mcp-PDUD7SGP.js +249 -0
- package/dist/mcp-installer-PQU3XOGO.js +259 -0
- package/dist/mcp-setup-OA7IB3H3.js +263 -0
- package/dist/{memory-Y6OZTXJ2.js → memory-ZNAEAK3B.js} +17 -17
- package/dist/{ollama-3XCUZMZT-FYKHW4TZ.js → ollama-3XCUZMZT-4JMH6B7P.js} +1 -1
- package/dist/{openai-E7G2YAHU-UYY4ZWON.js → openai-E7G2YAHU-T3HMBPH7.js} +2 -2
- package/dist/portal-JYWVHXDU.js +210 -0
- package/dist/prd-Q4J5NVAR.js +408 -0
- package/dist/repos-WWZXNN3P.js +271 -0
- package/dist/review-integration-5WHEJU2A.js +14 -0
- package/dist/{rules-E427DKYJ.js → rules-Y4VSOY5Y.js} +3 -3
- package/dist/run-VPNXEIBY.js +687 -0
- package/dist/server-COL4AXKU-P7S7NNF6.js +11 -0
- package/dist/server-KKSETHDV-XSSLEENT.js +20 -0
- package/dist/{skills-CX73O3IV.js → skills-QEYU2N27.js} +4 -2
- package/dist/start-JYOEL7AJ.js +303 -0
- package/dist/{status-4DFHDJMN.js → status-BHQYYGAL.js} +2 -2
- package/dist/{templates-U7T6MARD.js → templates-CBRUJ66V.js} +4 -3
- package/dist/tui-DP7736EX.js +61 -0
- package/dist/ulpi-5EN6JCAS-LFE3WSL4.js +10 -0
- package/dist/{uninstall-6SW35IK4.js → uninstall-ICUV6DDV.js} +3 -3
- package/dist/{update-M6IBJNYP.js → update-7ZMAYRBH.js} +3 -3
- package/dist/{version-checker-Q6YTYAGP.js → version-checker-4ZFMZA7Y.js} +2 -2
- package/package.json +39 -31
- package/dist/chunk-2MZER6ND.js +0 -415
- package/dist/chunk-2VYFVYJL.js +0 -4273
- package/dist/chunk-6OCEY7JY.js +0 -422
- package/dist/chunk-7LXY5UVC.js +0 -330
- package/dist/chunk-B55DDP24.js +0 -136
- package/dist/chunk-JWUUVXIV.js +0 -13694
- package/dist/chunk-MIAQVCFW.js +0 -39
- package/dist/chunk-YM2HV4IA.js +0 -505
- package/dist/ci-STSL2LSP.js +0 -370
- package/dist/mcp-installer-NQCGKQ23.js +0 -124
- package/dist/projects-ATHDD3D6.js +0 -271
- package/dist/review-ADUPV3PN.js +0 -152
- package/dist/server-USLHY6GH-AEOJC5ST.js +0 -18
- package/dist/server-X5P6WH2M-7K2RY34N.js +0 -11
- package/dist/skills/ulpi-generate-guardian/SKILL.md +0 -750
- package/dist/skills/ulpi-generate-guardian/references/framework-rules.md +0 -849
- package/dist/skills/ulpi-generate-guardian/references/language-rules.md +0 -591
- package/dist/ui-OWXZ3YSR.js +0 -167
- package/dist/ui.html +0 -698
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
// ../../packages/http/dist/middleware/auth.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
|
+
var LOOPBACK_ADDRESSES = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
|
|
14
|
+
function validateLoopback(req) {
|
|
15
|
+
const remoteAddr = req.socket.remoteAddress ?? "";
|
|
16
|
+
return LOOPBACK_ADDRESSES.has(remoteAddr);
|
|
17
|
+
}
|
|
18
|
+
function validateAuth(req) {
|
|
19
|
+
if (!validateLoopback(req))
|
|
20
|
+
return false;
|
|
21
|
+
if (apiSecret) {
|
|
22
|
+
const headerSecret = req.headers["x-ulpi-secret"];
|
|
23
|
+
if (headerSecret === apiSecret)
|
|
24
|
+
return true;
|
|
25
|
+
try {
|
|
26
|
+
const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
|
|
27
|
+
const paramSecret = url.searchParams.get("secret");
|
|
28
|
+
if (paramSecret === apiSecret)
|
|
29
|
+
return true;
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ../../packages/http/dist/router.js
|
|
38
|
+
function createRouter() {
|
|
39
|
+
const routes = [];
|
|
40
|
+
function add(method, pattern, handler) {
|
|
41
|
+
routes.push({ method, pattern, handler });
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
get(pattern, handler) {
|
|
45
|
+
add("GET", pattern, handler);
|
|
46
|
+
},
|
|
47
|
+
post(pattern, handler) {
|
|
48
|
+
add("POST", pattern, handler);
|
|
49
|
+
},
|
|
50
|
+
put(pattern, handler) {
|
|
51
|
+
add("PUT", pattern, handler);
|
|
52
|
+
},
|
|
53
|
+
patch(pattern, handler) {
|
|
54
|
+
add("PATCH", pattern, handler);
|
|
55
|
+
},
|
|
56
|
+
delete(pattern, handler) {
|
|
57
|
+
add("DELETE", pattern, handler);
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Try each registered route in order. For string patterns, performs an
|
|
61
|
+
* exact match against `ctx.pathname`. For RegExp patterns, tests the
|
|
62
|
+
* pathname and extracts named groups (or positional captures indexed by
|
|
63
|
+
* their number) into `params`.
|
|
64
|
+
*
|
|
65
|
+
* Returns `true` if a matching route was found (and its handler was
|
|
66
|
+
* invoked), `false` otherwise.
|
|
67
|
+
*/
|
|
68
|
+
async handle(ctx) {
|
|
69
|
+
for (const route of routes) {
|
|
70
|
+
if (route.method !== ctx.method)
|
|
71
|
+
continue;
|
|
72
|
+
let params = {};
|
|
73
|
+
if (typeof route.pattern === "string") {
|
|
74
|
+
if (ctx.pathname !== route.pattern)
|
|
75
|
+
continue;
|
|
76
|
+
} else {
|
|
77
|
+
const match = route.pattern.exec(ctx.pathname);
|
|
78
|
+
if (!match)
|
|
79
|
+
continue;
|
|
80
|
+
if (match.groups) {
|
|
81
|
+
params = { ...match.groups };
|
|
82
|
+
}
|
|
83
|
+
for (let i = 1; i < match.length; i++) {
|
|
84
|
+
if (match[i] !== void 0) {
|
|
85
|
+
params[String(i)] = decodeURIComponent(match[i]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
await route.handler({ ...ctx, params });
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ../../packages/http/dist/request.js
|
|
98
|
+
function readBody(req, maxSize = 1048576) {
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
const chunks = [];
|
|
101
|
+
let size = 0;
|
|
102
|
+
req.on("data", (chunk) => {
|
|
103
|
+
size += chunk.length;
|
|
104
|
+
if (size > maxSize) {
|
|
105
|
+
req.destroy();
|
|
106
|
+
reject(new Error("Request body too large"));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
chunks.push(chunk);
|
|
110
|
+
});
|
|
111
|
+
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
|
|
112
|
+
req.on("error", reject);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function readBodyRaw(req, maxSize = 5 * 1024 * 1024) {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
const chunks = [];
|
|
118
|
+
let size = 0;
|
|
119
|
+
req.on("data", (chunk) => {
|
|
120
|
+
size += chunk.length;
|
|
121
|
+
if (size > maxSize) {
|
|
122
|
+
req.destroy();
|
|
123
|
+
reject(new Error("Request body too large"));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
chunks.push(chunk);
|
|
127
|
+
});
|
|
128
|
+
req.on("end", () => resolve(Buffer.concat(chunks)));
|
|
129
|
+
req.on("error", reject);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async function parseJsonBody(req) {
|
|
133
|
+
try {
|
|
134
|
+
const raw = await readBody(req);
|
|
135
|
+
const parsed = JSON.parse(raw);
|
|
136
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
137
|
+
return { data: null, error: "Expected a JSON object" };
|
|
138
|
+
}
|
|
139
|
+
return { data: parsed, error: null };
|
|
140
|
+
} catch (err) {
|
|
141
|
+
const message = err instanceof Error ? err.message : "Invalid JSON body";
|
|
142
|
+
return { data: null, error: message };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function parseMultipartImage(body, boundary) {
|
|
146
|
+
const boundaryBuffer = Buffer.from(`--${boundary}`);
|
|
147
|
+
const start = body.indexOf(boundaryBuffer);
|
|
148
|
+
if (start === -1)
|
|
149
|
+
return null;
|
|
150
|
+
const headerEnd = body.indexOf(Buffer.from("\r\n\r\n"), start);
|
|
151
|
+
if (headerEnd === -1)
|
|
152
|
+
return null;
|
|
153
|
+
const headers = body.subarray(start + boundaryBuffer.length + 2, headerEnd).toString();
|
|
154
|
+
const ctMatch = headers.match(/Content-Type:\s*(.+)/i);
|
|
155
|
+
const contentType = ctMatch ? ctMatch[1].trim() : "image/png";
|
|
156
|
+
const dataStart = headerEnd + 4;
|
|
157
|
+
const nextBoundary = body.indexOf(boundaryBuffer, dataStart);
|
|
158
|
+
const dataEnd = nextBoundary !== -1 ? nextBoundary - 2 : body.length;
|
|
159
|
+
return { data: body.subarray(dataStart, dataEnd), contentType };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// ../../packages/http/dist/response.js
|
|
163
|
+
function resolveOrigin(options, req) {
|
|
164
|
+
if (!options)
|
|
165
|
+
return "*";
|
|
166
|
+
if (typeof options.origin === "function")
|
|
167
|
+
return options.origin(req);
|
|
168
|
+
return options.origin;
|
|
169
|
+
}
|
|
170
|
+
function corsHeaders(options, req) {
|
|
171
|
+
const headers = {
|
|
172
|
+
"Access-Control-Allow-Origin": resolveOrigin(options, req),
|
|
173
|
+
"Access-Control-Allow-Methods": options?.methods ?? "GET, POST, PUT, PATCH, DELETE, OPTIONS",
|
|
174
|
+
"Access-Control-Allow-Headers": options?.headers ?? "Content-Type, Authorization"
|
|
175
|
+
};
|
|
176
|
+
if (options?.credentials) {
|
|
177
|
+
headers["Access-Control-Allow-Credentials"] = "true";
|
|
178
|
+
}
|
|
179
|
+
if (options?.maxAge) {
|
|
180
|
+
headers["Access-Control-Max-Age"] = String(options.maxAge);
|
|
181
|
+
}
|
|
182
|
+
return headers;
|
|
183
|
+
}
|
|
184
|
+
function jsonResponse(res, data, status = 200, req, cors) {
|
|
185
|
+
const body = JSON.stringify(data);
|
|
186
|
+
res.writeHead(status, {
|
|
187
|
+
"Content-Type": "application/json",
|
|
188
|
+
...corsHeaders(cors, req)
|
|
189
|
+
});
|
|
190
|
+
res.end(body);
|
|
191
|
+
}
|
|
192
|
+
function notFound(res, message = "Not found", req, cors) {
|
|
193
|
+
jsonResponse(res, { error: message }, 404, req, cors);
|
|
194
|
+
}
|
|
195
|
+
function sseHeaders(res, req, cors) {
|
|
196
|
+
res.writeHead(200, {
|
|
197
|
+
"Content-Type": "text/event-stream",
|
|
198
|
+
"Cache-Control": "no-cache",
|
|
199
|
+
Connection: "keep-alive",
|
|
200
|
+
...corsHeaders(cors, req)
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function sseEvent(res, eventName, data) {
|
|
204
|
+
res.write(`event: ${eventName}
|
|
205
|
+
data: ${JSON.stringify(data)}
|
|
206
|
+
|
|
207
|
+
`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// ../../packages/http/dist/middleware/rate-limit.js
|
|
211
|
+
var store = /* @__PURE__ */ new Map();
|
|
212
|
+
var CLEANUP_INTERVAL = 6e4;
|
|
213
|
+
setInterval(() => {
|
|
214
|
+
const now = Date.now();
|
|
215
|
+
for (const [key, entry] of store) {
|
|
216
|
+
if (now >= entry.resetAt) {
|
|
217
|
+
store.delete(key);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}, CLEANUP_INTERVAL).unref();
|
|
221
|
+
function checkRateLimit(key, limit = 200, windowMs = 6e4) {
|
|
222
|
+
const now = Date.now();
|
|
223
|
+
const entry = store.get(key);
|
|
224
|
+
if (!entry || now >= entry.resetAt) {
|
|
225
|
+
store.set(key, { count: 1, resetAt: now + windowMs });
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
entry.count++;
|
|
229
|
+
return entry.count <= limit;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// ../../packages/http/dist/middleware/cors.js
|
|
233
|
+
function handleCorsPreFlight(req, res, options) {
|
|
234
|
+
if ((req.method ?? "GET") !== "OPTIONS")
|
|
235
|
+
return false;
|
|
236
|
+
res.writeHead(204, corsHeaders(options, req));
|
|
237
|
+
res.end();
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ../../packages/http/dist/websocket.js
|
|
242
|
+
import { WebSocketServer } from "ws";
|
|
243
|
+
|
|
244
|
+
// ../../packages/http/dist/sse.js
|
|
245
|
+
var SSEBroadcaster = class _SSEBroadcaster {
|
|
246
|
+
static MAX_CLIENTS = 100;
|
|
247
|
+
clients = /* @__PURE__ */ new Set();
|
|
248
|
+
/** Check if the broadcaster can accept another client. */
|
|
249
|
+
canAccept() {
|
|
250
|
+
return this.clients.size < _SSEBroadcaster.MAX_CLIENTS;
|
|
251
|
+
}
|
|
252
|
+
/** Register a new SSE client. */
|
|
253
|
+
add(res) {
|
|
254
|
+
this.clients.add(res);
|
|
255
|
+
}
|
|
256
|
+
/** Remove a disconnected SSE client. */
|
|
257
|
+
remove(res) {
|
|
258
|
+
this.clients.delete(res);
|
|
259
|
+
}
|
|
260
|
+
/** Broadcast a named SSE event to every connected client. */
|
|
261
|
+
broadcast(eventName, data) {
|
|
262
|
+
const message = `event: ${eventName}
|
|
263
|
+
data: ${JSON.stringify(data)}
|
|
264
|
+
|
|
265
|
+
`;
|
|
266
|
+
for (const client of this.clients) {
|
|
267
|
+
try {
|
|
268
|
+
client.write(message);
|
|
269
|
+
} catch {
|
|
270
|
+
this.clients.delete(client);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/** Number of currently connected clients. */
|
|
275
|
+
get size() {
|
|
276
|
+
return this.clients.size;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export {
|
|
281
|
+
createRouter,
|
|
282
|
+
readBody,
|
|
283
|
+
readBodyRaw,
|
|
284
|
+
parseJsonBody,
|
|
285
|
+
parseMultipartImage,
|
|
286
|
+
jsonResponse,
|
|
287
|
+
notFound,
|
|
288
|
+
sseHeaders,
|
|
289
|
+
sseEvent,
|
|
290
|
+
generateApiSecret,
|
|
291
|
+
setApiSecret,
|
|
292
|
+
getApiSecret,
|
|
293
|
+
validateLoopback,
|
|
294
|
+
validateAuth,
|
|
295
|
+
checkRateLimit,
|
|
296
|
+
handleCorsPreFlight,
|
|
297
|
+
SSEBroadcaster
|
|
298
|
+
};
|