@justmpm/ai-tool 3.24.0 → 4.0.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/dist/{chunk-LKP6Z3JC.js → chunk-BFOWLQIL.js} +0 -515
- package/dist/chunk-OQSQWBJV.js +387 -0
- package/dist/cli.js +4 -58
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{server-T6IW5ZR7.js → server-QFWWHDJY.js} +2 -157
- package/package.json +4 -2
- package/dist/chunk-ERMF7MJF.js +0 -2189
|
@@ -201,18 +201,6 @@ var COMMAND_MAP = {
|
|
|
201
201
|
changes_staged: {
|
|
202
202
|
cli: "ai-tool changes --staged",
|
|
203
203
|
mcp: "analyze__aitool_changes { target: 'staged' }"
|
|
204
|
-
},
|
|
205
|
-
deps_info: {
|
|
206
|
-
cli: "ai-tool deps info <pacote>",
|
|
207
|
-
mcp: "analyze__aitool_deps_info { package: '<pacote>' }"
|
|
208
|
-
},
|
|
209
|
-
deps_api: {
|
|
210
|
-
cli: "ai-tool deps api <pacote>",
|
|
211
|
-
mcp: "analyze__aitool_deps_api { package: '<pacote>' }"
|
|
212
|
-
},
|
|
213
|
-
deps_search: {
|
|
214
|
-
cli: "ai-tool deps search <pacote> <termo>",
|
|
215
|
-
mcp: "analyze__aitool_deps_search { package: '<pacote>', query: '<termo>' }"
|
|
216
204
|
}
|
|
217
205
|
};
|
|
218
206
|
function hint(command, ctx, params) {
|
|
@@ -282,18 +270,6 @@ var NEXT_STEPS = {
|
|
|
282
270
|
{ command: "context", description: "ver assinaturas atuais de um arquivo modificado" },
|
|
283
271
|
{ command: "impact", description: "ver impacto das mudancas em outros arquivos" },
|
|
284
272
|
{ command: "suggest", description: "o que ler antes de editar um arquivo modificado" }
|
|
285
|
-
],
|
|
286
|
-
deps_info: [
|
|
287
|
-
{ command: "deps_api", description: "ver API publica do pacote" },
|
|
288
|
-
{ command: "deps_search", description: "buscar simbolo especifico no pacote" }
|
|
289
|
-
],
|
|
290
|
-
deps_api: [
|
|
291
|
-
{ command: "deps_search", description: "buscar simbolo especifico" },
|
|
292
|
-
{ command: "deps_info", description: "ver metadados do pacote" }
|
|
293
|
-
],
|
|
294
|
-
deps_search: [
|
|
295
|
-
{ command: "deps_api", description: "ver toda a API publica" },
|
|
296
|
-
{ command: "deps_info", description: "ver metadados do pacote" }
|
|
297
273
|
]
|
|
298
274
|
};
|
|
299
275
|
function nextSteps(command, ctx) {
|
|
@@ -359,12 +335,6 @@ function recoveryHint(errorType, ctx, _extra) {
|
|
|
359
335
|
\u2192 ${hint("find", ctx)} - buscar com outro termo
|
|
360
336
|
\u2192 ${hint("describe", ctx)} - buscar areas por descricao
|
|
361
337
|
\u2192 ${hint("map", ctx)} - ver estrutura do projeto
|
|
362
|
-
`;
|
|
363
|
-
case "package_not_found":
|
|
364
|
-
return `
|
|
365
|
-
\u{1F4A1} Pacote nao encontrado no node_modules.
|
|
366
|
-
\u2192 Verifique se o pacote esta instalado no projeto
|
|
367
|
-
\u2192 ${hint("deps_info", ctx)} - use deps info para confirmar se esta instalado
|
|
368
338
|
`;
|
|
369
339
|
case "index_failed":
|
|
370
340
|
return `
|
|
@@ -382,77 +352,6 @@ function recoveryHint(errorType, ctx, _extra) {
|
|
|
382
352
|
}
|
|
383
353
|
}
|
|
384
354
|
|
|
385
|
-
// src/utils/semver.ts
|
|
386
|
-
function parseVersion(version) {
|
|
387
|
-
const trimmed = version.trim();
|
|
388
|
-
const clean = trimmed.startsWith("v") ? trimmed.slice(1) : trimmed;
|
|
389
|
-
const parts = clean.split(".");
|
|
390
|
-
if (parts.length < 2) return null;
|
|
391
|
-
const major = parseInt(parts[0], 10);
|
|
392
|
-
if (isNaN(major)) return null;
|
|
393
|
-
const minor = parseInt(parts[1], 10);
|
|
394
|
-
if (isNaN(minor)) return null;
|
|
395
|
-
const patch = parts.length >= 3 ? parseInt(parts[2], 10) : 0;
|
|
396
|
-
if (isNaN(patch)) return null;
|
|
397
|
-
return { major, minor, patch };
|
|
398
|
-
}
|
|
399
|
-
function compareSemver(a, b) {
|
|
400
|
-
if (a.major !== b.major) return a.major < b.major ? -1 : 1;
|
|
401
|
-
if (a.minor !== b.minor) return a.minor < b.minor ? -1 : 1;
|
|
402
|
-
if (a.patch !== b.patch) return a.patch < b.patch ? -1 : 1;
|
|
403
|
-
return 0;
|
|
404
|
-
}
|
|
405
|
-
function satisfiesComparator(installed, comparator) {
|
|
406
|
-
const trimmed = comparator.trim();
|
|
407
|
-
if (trimmed.startsWith("^")) {
|
|
408
|
-
const target = parseVersion(trimmed.slice(1));
|
|
409
|
-
if (!target) return true;
|
|
410
|
-
return installed.major === target.major && compareSemver(installed, target) >= 0;
|
|
411
|
-
}
|
|
412
|
-
if (trimmed.startsWith("~")) {
|
|
413
|
-
const target = parseVersion(trimmed.slice(1));
|
|
414
|
-
if (!target) return true;
|
|
415
|
-
return installed.major === target.major && installed.minor === target.minor && compareSemver(installed, target) >= 0;
|
|
416
|
-
}
|
|
417
|
-
if (trimmed.startsWith(">=")) {
|
|
418
|
-
const target = parseVersion(trimmed.slice(2));
|
|
419
|
-
if (!target) return true;
|
|
420
|
-
return compareSemver(installed, target) >= 0;
|
|
421
|
-
}
|
|
422
|
-
if (trimmed.startsWith("<=")) {
|
|
423
|
-
const target = parseVersion(trimmed.slice(2));
|
|
424
|
-
if (!target) return true;
|
|
425
|
-
return compareSemver(installed, target) <= 0;
|
|
426
|
-
}
|
|
427
|
-
if (trimmed.startsWith(">") && !trimmed.startsWith(">=")) {
|
|
428
|
-
const target = parseVersion(trimmed.slice(1));
|
|
429
|
-
if (!target) return true;
|
|
430
|
-
return compareSemver(installed, target) > 0;
|
|
431
|
-
}
|
|
432
|
-
if (trimmed.startsWith("<") && !trimmed.startsWith("<=")) {
|
|
433
|
-
const target = parseVersion(trimmed.slice(1));
|
|
434
|
-
if (!target) return true;
|
|
435
|
-
return compareSemver(installed, target) < 0;
|
|
436
|
-
}
|
|
437
|
-
const exact = parseVersion(trimmed);
|
|
438
|
-
if (!exact) return true;
|
|
439
|
-
return compareSemver(installed, exact) === 0;
|
|
440
|
-
}
|
|
441
|
-
function satisfiesSemver(installed, declared) {
|
|
442
|
-
const installedVersion = parseVersion(installed);
|
|
443
|
-
if (!installedVersion) return true;
|
|
444
|
-
const orParts = declared.split("||");
|
|
445
|
-
for (const orPart of orParts) {
|
|
446
|
-
const comparators = orPart.trim().split(/\s+/).filter((c) => c.length > 0);
|
|
447
|
-
if (comparators.length === 0) continue;
|
|
448
|
-
const allSatisfy = comparators.every(
|
|
449
|
-
(comp) => satisfiesComparator(installedVersion, comp)
|
|
450
|
-
);
|
|
451
|
-
if (allSatisfy) return true;
|
|
452
|
-
}
|
|
453
|
-
return false;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
355
|
// src/utils/similarity.ts
|
|
457
356
|
function levenshteinDistance(a, b) {
|
|
458
357
|
const matrix = [];
|
|
@@ -2098,410 +1997,6 @@ function formatUsageExamples(examples, indent = 2) {
|
|
|
2098
1997
|
}
|
|
2099
1998
|
return out;
|
|
2100
1999
|
}
|
|
2101
|
-
function formatDepsInfoText(result, ctx = "cli") {
|
|
2102
|
-
let out = "";
|
|
2103
|
-
const info = result.info;
|
|
2104
|
-
const name = info.name || result.package;
|
|
2105
|
-
out += `${name} v${info.version}`;
|
|
2106
|
-
out += `
|
|
2107
|
-
`;
|
|
2108
|
-
if (result.declaredVersion) {
|
|
2109
|
-
if (satisfiesSemver(info.version, result.declaredVersion)) {
|
|
2110
|
-
out += ` Status: OK
|
|
2111
|
-
`;
|
|
2112
|
-
} else {
|
|
2113
|
-
out += ` Status: desatualizada (declarada: ${result.declaredVersion})
|
|
2114
|
-
`;
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
if (info.description) {
|
|
2118
|
-
out += ` Descricao: ${info.description}
|
|
2119
|
-
`;
|
|
2120
|
-
}
|
|
2121
|
-
if (info.hasTypes) {
|
|
2122
|
-
if (info.typesSource === "@types" && info.typesPackage) {
|
|
2123
|
-
out += ` Tipos: ${info.typesPackage} (pacote separado)
|
|
2124
|
-
`;
|
|
2125
|
-
} else if (info.types) {
|
|
2126
|
-
out += ` Tipos: ${info.types}
|
|
2127
|
-
`;
|
|
2128
|
-
} else if (info.typings) {
|
|
2129
|
-
out += ` Tipos: ${info.typings}
|
|
2130
|
-
`;
|
|
2131
|
-
} else {
|
|
2132
|
-
out += ` Tipos: embutidos (via exports)
|
|
2133
|
-
`;
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
const mainEntries = result.entryPoints.filter(
|
|
2137
|
-
(ep) => ep.type === "main" || ep.type === "types" || ep.type === "module"
|
|
2138
|
-
);
|
|
2139
|
-
const otherCount = result.entryPoints.length - mainEntries.length;
|
|
2140
|
-
out += ` Entry points: (${result.entryPoints.length})
|
|
2141
|
-
`;
|
|
2142
|
-
const topLevel = mainEntries.filter((ep) => {
|
|
2143
|
-
const conditions = ep.condition.split(", ");
|
|
2144
|
-
return conditions.every((c) => !c.startsWith("./"));
|
|
2145
|
-
});
|
|
2146
|
-
const subExports = mainEntries.filter((ep) => {
|
|
2147
|
-
const conditions = ep.condition.split(", ");
|
|
2148
|
-
return conditions.some((c) => c.startsWith("./"));
|
|
2149
|
-
});
|
|
2150
|
-
for (const ep of topLevel) {
|
|
2151
|
-
const fileName = ep.path.split(/[\\/]/).pop() || ep.path;
|
|
2152
|
-
const conditions = ep.condition.split(", ");
|
|
2153
|
-
if (conditions.length > 1) {
|
|
2154
|
-
out += ` ${ep.type}: ${fileName} [${conditions.length} conditions]
|
|
2155
|
-
`;
|
|
2156
|
-
} else {
|
|
2157
|
-
out += ` ${ep.type}: ${fileName}
|
|
2158
|
-
`;
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
if (subExports.length > 0) {
|
|
2162
|
-
const grouped = /* @__PURE__ */ new Map();
|
|
2163
|
-
for (const ep of subExports) {
|
|
2164
|
-
const conditions = ep.condition.split(", ");
|
|
2165
|
-
const subExportCondition = conditions.find((c) => c.startsWith("./"));
|
|
2166
|
-
if (!subExportCondition) continue;
|
|
2167
|
-
const exportKeyMatch = subExportCondition.match(/^(\.\/[^/]+)/);
|
|
2168
|
-
const exportKey = exportKeyMatch ? exportKeyMatch[1] : subExportCondition;
|
|
2169
|
-
const existing = grouped.get(exportKey);
|
|
2170
|
-
if (existing) {
|
|
2171
|
-
existing.push({ condition: subExportCondition, path: ep.path, type: ep.type });
|
|
2172
|
-
} else {
|
|
2173
|
-
grouped.set(exportKey, [{ condition: subExportCondition, path: ep.path, type: ep.type }]);
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
out += ` Sub-exports (${grouped.size}):
|
|
2177
|
-
`;
|
|
2178
|
-
for (const [exportKey, entries] of grouped) {
|
|
2179
|
-
const moduleName = exportKey.replace(/^\.\//, "");
|
|
2180
|
-
const normalizedPath = entries[0].path.replace(/\\/g, "/");
|
|
2181
|
-
const pkgMatch = normalizedPath.match(/node_modules\/[^/]+\/(.+)/);
|
|
2182
|
-
const relativePath = pkgMatch ? pkgMatch[1] : normalizedPath.split(/[\\/]/).pop() || entries[0].path;
|
|
2183
|
-
if (entries.length === 1) {
|
|
2184
|
-
out += ` ${moduleName}: ${relativePath}
|
|
2185
|
-
`;
|
|
2186
|
-
} else {
|
|
2187
|
-
const variantNames = entries.map((e) => {
|
|
2188
|
-
const cond = e.condition.split(", ").find((c) => c.startsWith("./"));
|
|
2189
|
-
return cond?.replace(/^\.\/[^/]+\//, "") || "";
|
|
2190
|
-
}).filter(Boolean);
|
|
2191
|
-
out += ` ${moduleName}: ${relativePath} [${variantNames.join(", ")}]
|
|
2192
|
-
`;
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
if (otherCount > 0) {
|
|
2197
|
-
out += ` + ${otherCount} condicional(is) via exports
|
|
2198
|
-
`;
|
|
2199
|
-
}
|
|
2200
|
-
if (info.repository) {
|
|
2201
|
-
out += ` Repository: ${info.repository}
|
|
2202
|
-
`;
|
|
2203
|
-
}
|
|
2204
|
-
if (info.homepage) {
|
|
2205
|
-
out += ` Homepage: ${info.homepage}
|
|
2206
|
-
`;
|
|
2207
|
-
}
|
|
2208
|
-
if (info.license) {
|
|
2209
|
-
out += ` License: ${info.license}
|
|
2210
|
-
`;
|
|
2211
|
-
}
|
|
2212
|
-
const peerDeps = Object.entries(info.peerDependencies);
|
|
2213
|
-
if (peerDeps.length > 0) {
|
|
2214
|
-
out += `
|
|
2215
|
-
Peer dependencies (${peerDeps.length}):
|
|
2216
|
-
`;
|
|
2217
|
-
for (const [depName, depVer] of peerDeps.slice(0, 5)) {
|
|
2218
|
-
out += ` ${depName}: ${depVer}
|
|
2219
|
-
`;
|
|
2220
|
-
}
|
|
2221
|
-
if (peerDeps.length > 5) {
|
|
2222
|
-
out += ` + ${peerDeps.length - 5} outras
|
|
2223
|
-
`;
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
const directDeps = Object.entries(info.dependencies);
|
|
2227
|
-
if (directDeps.length > 0) {
|
|
2228
|
-
const depCount = directDeps.length;
|
|
2229
|
-
out += ` Dependencias diretas: ${depCount}`;
|
|
2230
|
-
if (depCount > 0) {
|
|
2231
|
-
out += ` (top 5):
|
|
2232
|
-
`;
|
|
2233
|
-
for (const [depName, depVer] of directDeps.slice(0, 5)) {
|
|
2234
|
-
out += ` ${depName}: ${depVer}
|
|
2235
|
-
`;
|
|
2236
|
-
}
|
|
2237
|
-
if (depCount > 5) {
|
|
2238
|
-
out += ` + ${depCount - 5} outras
|
|
2239
|
-
`;
|
|
2240
|
-
}
|
|
2241
|
-
} else {
|
|
2242
|
-
out += `
|
|
2243
|
-
`;
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
out += nextSteps("deps_info", ctx);
|
|
2247
|
-
return out;
|
|
2248
|
-
}
|
|
2249
|
-
function formatDepsApiText(result, ctx = "cli") {
|
|
2250
|
-
let out = "";
|
|
2251
|
-
const typeFileLabel = result.typeFilesSummary ? result.typeFilesSummary : result.typeFiles.length === 1 ? "1 type file" : `${result.typeFiles.length} type files`;
|
|
2252
|
-
if (result.typesSource === "@types") {
|
|
2253
|
-
out += `${result.package} - API Publica (via ${result.typesPackage})
|
|
2254
|
-
|
|
2255
|
-
`;
|
|
2256
|
-
} else if (result.typesSource === "js-fallback" || result.jsFallback) {
|
|
2257
|
-
out += `${result.package} - API Publica (tipos aproximados de JS)
|
|
2258
|
-
|
|
2259
|
-
`;
|
|
2260
|
-
} else if (result.typesSource === "builtin") {
|
|
2261
|
-
out += `${result.package} - API Publica (${typeFileLabel} - tipos embutidos)
|
|
2262
|
-
|
|
2263
|
-
`;
|
|
2264
|
-
} else {
|
|
2265
|
-
out += `${result.package} - API Publica (${typeFileLabel})
|
|
2266
|
-
|
|
2267
|
-
`;
|
|
2268
|
-
}
|
|
2269
|
-
if (result.typeFilesPreview && result.typeFilesPreview.length > 0) {
|
|
2270
|
-
out += `TYPE FILES (top ${result.typeFilesPreview.length})
|
|
2271
|
-
`;
|
|
2272
|
-
for (const tf of result.typeFilesPreview) {
|
|
2273
|
-
out += ` ${tf}
|
|
2274
|
-
`;
|
|
2275
|
-
}
|
|
2276
|
-
out += `
|
|
2277
|
-
`;
|
|
2278
|
-
}
|
|
2279
|
-
const components = result.functions.filter((f) => f.kind === "component");
|
|
2280
|
-
const hooks = result.functions.filter((f) => f.kind === "hook");
|
|
2281
|
-
const plainFunctions = result.functions.filter((f) => f.kind !== "component" && f.kind !== "hook");
|
|
2282
|
-
if (components.length > 0) {
|
|
2283
|
-
out += `COMPONENTS (${components.length})
|
|
2284
|
-
`;
|
|
2285
|
-
for (const fn of components) {
|
|
2286
|
-
const params = fn.params.map((p) => `${p.name}: ${p.type}`).join(", ");
|
|
2287
|
-
out += ` ${fn.name}(${params}): ${fn.returnType}
|
|
2288
|
-
`;
|
|
2289
|
-
}
|
|
2290
|
-
out += `
|
|
2291
|
-
`;
|
|
2292
|
-
}
|
|
2293
|
-
if (hooks.length > 0) {
|
|
2294
|
-
out += `HOOKS (${hooks.length})
|
|
2295
|
-
`;
|
|
2296
|
-
for (const fn of hooks) {
|
|
2297
|
-
const asyncLabel = fn.isAsync ? "async " : "";
|
|
2298
|
-
const params = fn.params.map((p) => `${p.name}: ${p.type}`).join(", ");
|
|
2299
|
-
out += ` ${asyncLabel}${fn.name}(${params}): ${fn.returnType}
|
|
2300
|
-
`;
|
|
2301
|
-
}
|
|
2302
|
-
out += `
|
|
2303
|
-
`;
|
|
2304
|
-
}
|
|
2305
|
-
if (plainFunctions.length > 0) {
|
|
2306
|
-
out += `FUNCTIONS (${plainFunctions.length})
|
|
2307
|
-
`;
|
|
2308
|
-
for (const fn of plainFunctions) {
|
|
2309
|
-
const asyncLabel = fn.isAsync ? "async " : "";
|
|
2310
|
-
const params = fn.params.map((p) => `${p.name}: ${p.type}`).join(", ");
|
|
2311
|
-
out += ` ${asyncLabel}${fn.name}(${params}): ${fn.returnType}
|
|
2312
|
-
`;
|
|
2313
|
-
}
|
|
2314
|
-
out += `
|
|
2315
|
-
`;
|
|
2316
|
-
}
|
|
2317
|
-
const interfaces = result.types.filter((t) => t.kind === "interface");
|
|
2318
|
-
const typeAliases = result.types.filter((t) => t.kind === "type");
|
|
2319
|
-
const enums = result.types.filter((t) => t.kind === "enum");
|
|
2320
|
-
if (interfaces.length > 0) {
|
|
2321
|
-
out += `INTERFACES (${interfaces.length})
|
|
2322
|
-
`;
|
|
2323
|
-
for (const t of interfaces) {
|
|
2324
|
-
const def = truncateText(t.definition, 100);
|
|
2325
|
-
out += ` ${t.name}
|
|
2326
|
-
`;
|
|
2327
|
-
out += ` ${def}
|
|
2328
|
-
`;
|
|
2329
|
-
}
|
|
2330
|
-
out += `
|
|
2331
|
-
`;
|
|
2332
|
-
}
|
|
2333
|
-
if (typeAliases.length > 0) {
|
|
2334
|
-
out += `TYPE ALIASES (${typeAliases.length})
|
|
2335
|
-
`;
|
|
2336
|
-
for (const t of typeAliases) {
|
|
2337
|
-
const def = truncateText(t.definition, 100);
|
|
2338
|
-
out += ` ${def}
|
|
2339
|
-
`;
|
|
2340
|
-
}
|
|
2341
|
-
out += `
|
|
2342
|
-
`;
|
|
2343
|
-
}
|
|
2344
|
-
if (enums.length > 0) {
|
|
2345
|
-
out += `ENUMS (${enums.length})
|
|
2346
|
-
`;
|
|
2347
|
-
for (const t of enums) {
|
|
2348
|
-
const def = truncateText(t.definition, 100);
|
|
2349
|
-
out += ` ${def}
|
|
2350
|
-
`;
|
|
2351
|
-
}
|
|
2352
|
-
out += `
|
|
2353
|
-
`;
|
|
2354
|
-
}
|
|
2355
|
-
if (result.constants && result.constants.length > 0) {
|
|
2356
|
-
out += `CONSTANTS (${result.constants.length})
|
|
2357
|
-
`;
|
|
2358
|
-
for (const c of result.constants) {
|
|
2359
|
-
out += ` ${c.name}: ${c.type}
|
|
2360
|
-
`;
|
|
2361
|
-
}
|
|
2362
|
-
out += `
|
|
2363
|
-
`;
|
|
2364
|
-
}
|
|
2365
|
-
if (result.truncated.functions || result.truncated.types) {
|
|
2366
|
-
if (result.truncated.functions) {
|
|
2367
|
-
const total = result.truncated.totalFunctions ?? 50;
|
|
2368
|
-
out += `[truncated: functions ${result.functions.length}/${total}]
|
|
2369
|
-
`;
|
|
2370
|
-
}
|
|
2371
|
-
if (result.truncated.types) {
|
|
2372
|
-
const total = result.truncated.totalTypes ?? 50;
|
|
2373
|
-
out += `[truncated: types ${result.types.length}/${total}]
|
|
2374
|
-
`;
|
|
2375
|
-
}
|
|
2376
|
-
out += `Use ${hint("deps_search", ctx, { "<pacote>": result.package, "<termo>": "*Symbol*" })} para buscar simbolos especificos
|
|
2377
|
-
`;
|
|
2378
|
-
}
|
|
2379
|
-
if (result.availableKindsWhenFilteredEmpty && result.availableKindsWhenFilteredEmpty.length > 0) {
|
|
2380
|
-
const kinds = result.availableKindsWhenFilteredEmpty.map((k) => `${k.kind} (${k.count})`).join(", ");
|
|
2381
|
-
out += `
|
|
2382
|
-
Filtro --kind nao encontrou simbolos, mas ha outros tipos disponiveis:
|
|
2383
|
-
`;
|
|
2384
|
-
out += ` ${kinds}
|
|
2385
|
-
`;
|
|
2386
|
-
out += ` Use ${hint("deps_api", ctx, { "<pacote>": result.package })} sem filtro --kind para ver tudo
|
|
2387
|
-
`;
|
|
2388
|
-
}
|
|
2389
|
-
out += nextSteps("deps_api", ctx);
|
|
2390
|
-
return out;
|
|
2391
|
-
}
|
|
2392
|
-
function formatDepsSearchText(result, ctx = "cli") {
|
|
2393
|
-
let out = "";
|
|
2394
|
-
if (result.typesSource === "@types") {
|
|
2395
|
-
out += `${result.package} - Busca: "${result.query}" (via ${result.typesPackage})
|
|
2396
|
-
|
|
2397
|
-
`;
|
|
2398
|
-
} else if (result.typesSource === "js-fallback" || result.jsFallback) {
|
|
2399
|
-
out += `${result.package} - Busca: "${result.query}" (tipos aproximados)
|
|
2400
|
-
|
|
2401
|
-
`;
|
|
2402
|
-
} else if (result.typesSource === "builtin") {
|
|
2403
|
-
out += `${result.package} - Busca: "${result.query}" (tipos embutidos)
|
|
2404
|
-
|
|
2405
|
-
`;
|
|
2406
|
-
} else {
|
|
2407
|
-
out += `${result.package} - Busca: "${result.query}"
|
|
2408
|
-
|
|
2409
|
-
`;
|
|
2410
|
-
}
|
|
2411
|
-
if (result.matches.length === 0) {
|
|
2412
|
-
out += `Nenhum simbolo encontrado para "${result.query}".
|
|
2413
|
-
`;
|
|
2414
|
-
if (result.availableKindsWhenEmpty && result.availableKindsWhenEmpty.length > 0) {
|
|
2415
|
-
const kinds = result.availableKindsWhenEmpty.map((k) => `"${k}"`).join(", ");
|
|
2416
|
-
out += `
|
|
2417
|
-
Simbolos encontrados, mas como tipo diferente:
|
|
2418
|
-
`;
|
|
2419
|
-
out += ` Kinds disponiveis: ${kinds}
|
|
2420
|
-
`;
|
|
2421
|
-
out += ` Tente: ${hint("deps_search", ctx, { "<pacote>": result.package, "<termo>": result.query })} sem filtro --kind
|
|
2422
|
-
`;
|
|
2423
|
-
}
|
|
2424
|
-
if (result.typesSource === void 0 && !result.jsFallback) {
|
|
2425
|
-
out += `
|
|
2426
|
-
Pacote "${result.package}" nao possui TypeScript declarations.
|
|
2427
|
-
`;
|
|
2428
|
-
out += ` Instale com: npm install -D @types/${result.package}
|
|
2429
|
-
`;
|
|
2430
|
-
}
|
|
2431
|
-
out += `
|
|
2432
|
-
Dicas:
|
|
2433
|
-
`;
|
|
2434
|
-
out += ` -> Verifique a ortografia
|
|
2435
|
-
`;
|
|
2436
|
-
out += ` -> Tente buscar parte do nome (ex: "Btn" em vez de "Button")
|
|
2437
|
-
`;
|
|
2438
|
-
out += ` -> ${hint("deps_api", ctx, { "<pacote>": result.package })} - ver toda a API
|
|
2439
|
-
`;
|
|
2440
|
-
return out;
|
|
2441
|
-
}
|
|
2442
|
-
for (let i = 0; i < result.matches.length; i++) {
|
|
2443
|
-
const match = result.matches[i];
|
|
2444
|
-
out += `${i + 1}. ${match.name} (${match.kind})`;
|
|
2445
|
-
if (match.fromConcept) {
|
|
2446
|
-
out += ` [conceito: "${match.fromConcept}"]`;
|
|
2447
|
-
}
|
|
2448
|
-
out += `
|
|
2449
|
-
`;
|
|
2450
|
-
out += ` ${match.file}
|
|
2451
|
-
`;
|
|
2452
|
-
const sig = truncateText(match.signature, 100);
|
|
2453
|
-
out += ` ${sig}
|
|
2454
|
-
`;
|
|
2455
|
-
out += `
|
|
2456
|
-
`;
|
|
2457
|
-
}
|
|
2458
|
-
if (result.summary.byKind && result.summary.byKind.length > 1) {
|
|
2459
|
-
out += `POR KIND:
|
|
2460
|
-
`;
|
|
2461
|
-
for (const k of result.summary.byKind) {
|
|
2462
|
-
if (k.total > 0) {
|
|
2463
|
-
const truncInfo = k.shown < k.total ? ` (${k.shown}/${k.total})` : "";
|
|
2464
|
-
out += ` ${k.kind}: ${k.total}${truncInfo}
|
|
2465
|
-
`;
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
if (result.summary.byFile && result.summary.byFile.length > 1) {
|
|
2470
|
-
out += `POR ARQUIVO:
|
|
2471
|
-
`;
|
|
2472
|
-
for (const f of result.summary.byFile) {
|
|
2473
|
-
if (f.count > 1) {
|
|
2474
|
-
out += ` ${f.file}: ${f.count} matches
|
|
2475
|
-
`;
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
const shown = result.summary.shown;
|
|
2480
|
-
const total = result.summary.total;
|
|
2481
|
-
const hidden = result.summary.hidden;
|
|
2482
|
-
const pluralTotal = total !== 1 ? "s" : "";
|
|
2483
|
-
const pluralFiles = result.summary.files !== 1 ? "s" : "";
|
|
2484
|
-
if (hidden > 0) {
|
|
2485
|
-
out += `${shown} de ${total} resultado${pluralTotal} (${hidden} hidden)
|
|
2486
|
-
`;
|
|
2487
|
-
out += ` em ${result.summary.files} arquivo${pluralFiles}
|
|
2488
|
-
`;
|
|
2489
|
-
} else {
|
|
2490
|
-
out += `${total} resultado${pluralTotal} em ${result.summary.files} arquivo${pluralFiles}
|
|
2491
|
-
`;
|
|
2492
|
-
}
|
|
2493
|
-
if (total > 50) {
|
|
2494
|
-
out += `
|
|
2495
|
-
Muitos resultados encontrados. Refine a busca com termos mais especificos.
|
|
2496
|
-
`;
|
|
2497
|
-
}
|
|
2498
|
-
out += nextSteps("deps_search", ctx);
|
|
2499
|
-
return out;
|
|
2500
|
-
}
|
|
2501
|
-
function truncateText(text, maxLen) {
|
|
2502
|
-
if (text.length <= maxLen) return text;
|
|
2503
|
-
return text.substring(0, maxLen - 3) + "...";
|
|
2504
|
-
}
|
|
2505
2000
|
|
|
2506
2001
|
// src/cache/index.ts
|
|
2507
2002
|
import {
|
|
@@ -8728,13 +8223,7 @@ export {
|
|
|
8728
8223
|
findSimilar,
|
|
8729
8224
|
findBestMatch,
|
|
8730
8225
|
extractFileName,
|
|
8731
|
-
formatDepsInfoText,
|
|
8732
|
-
formatDepsApiText,
|
|
8733
|
-
formatDepsSearchText,
|
|
8734
|
-
logger,
|
|
8735
8226
|
getWorkspaceFiles,
|
|
8736
|
-
simplifyType,
|
|
8737
|
-
expandMuiOverrideType,
|
|
8738
8227
|
getProjectIndexArtifact,
|
|
8739
8228
|
isFirebaseProject,
|
|
8740
8229
|
hasFirebaseFunctions,
|
|
@@ -8767,10 +8256,6 @@ export {
|
|
|
8767
8256
|
formatInvalidCommand,
|
|
8768
8257
|
impact,
|
|
8769
8258
|
suggest,
|
|
8770
|
-
addSourceFile,
|
|
8771
|
-
extractFunctions,
|
|
8772
|
-
extractTypes,
|
|
8773
|
-
extractExports,
|
|
8774
8259
|
context,
|
|
8775
8260
|
areaContext,
|
|
8776
8261
|
areas,
|