@alaarab/cortex 1.13.2 → 1.13.3
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.
|
@@ -38,14 +38,24 @@ export function buildHookOutput(selected, usedTokens, intent, gitCtx, detectedPr
|
|
|
38
38
|
parts.push("");
|
|
39
39
|
for (const injected of indexEntries) {
|
|
40
40
|
recordInjection(cortexPathLocal, injected.key, sessionId);
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
recordRetrieval(cortexPathLocal, injected.doc.path ?? injected.doc.filename, injected.doc.type);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// best-effort
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
else {
|
|
45
50
|
for (const injected of selected) {
|
|
46
51
|
const { doc, snippet, key } = injected;
|
|
47
52
|
recordInjection(cortexPathLocal, key, sessionId);
|
|
48
|
-
|
|
53
|
+
try {
|
|
54
|
+
recordRetrieval(cortexPathLocal, doc.path ?? doc.filename, doc.type);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// best-effort
|
|
58
|
+
}
|
|
49
59
|
parts.push(`[${getDocSourceKey(doc, cortexPathLocal)}] (${doc.type})`);
|
|
50
60
|
parts.push(annotateStale(snippet));
|
|
51
61
|
parts.push("");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
|
+
const PROSE_ENTITY_PATTERN = /\b(React|Vue|Angular|Next\.js|Nuxt|Svelte|Express|Fastify|Koa|Hapi|NestJS|Django|Flask|FastAPI|Rails|Spring|Laravel|Redis|Postgres|PostgreSQL|MySQL|MariaDB|SQLite|MongoDB|DynamoDB|Cassandra|Elasticsearch|Docker|Kubernetes|Terraform|Ansible|AWS|GCP|Azure|Vercel|Netlify|Cloudflare|Prisma|TypeORM|Sequelize|Drizzle|Mongoose|Jest|Vitest|Mocha|Cypress|Playwright|Puppeteer|Webpack|Vite|Rollup|esbuild|Turbopack|ESLint|Prettier|Babel|SWC|GraphQL|REST|gRPC|WebSocket|Kafka|RabbitMQ|NATS|Nginx|Caddy|Traefik|Node\.js|Deno|Bun|Python|Rust|Go|Java|Kotlin|Swift|TypeScript|JavaScript)\b/gi;
|
|
2
3
|
const ENTITY_PATTERNS = [
|
|
3
4
|
// import/require patterns: import X from 'pkg' or require('pkg')
|
|
4
5
|
/(?:import\s+.*?\s+from\s+['"])(@?[\w\-/]+)(?:['"])/g,
|
|
@@ -6,7 +7,7 @@ const ENTITY_PATTERNS = [
|
|
|
6
7
|
// @scope/package patterns in text
|
|
7
8
|
/@[\w-]+\/[\w-]+/g,
|
|
8
9
|
// Known library/tool names mentioned in prose (case-insensitive word boundaries)
|
|
9
|
-
|
|
10
|
+
PROSE_ENTITY_PATTERN,
|
|
10
11
|
];
|
|
11
12
|
function extractEntityNames(content) {
|
|
12
13
|
const found = new Set();
|
package/mcp/dist/shared-index.js
CHANGED
|
@@ -617,12 +617,15 @@ export function getDocSourceKey(doc, cortexPath) {
|
|
|
617
617
|
return buildSourceDocKey(doc.project, doc.path, cortexPath, doc.filename);
|
|
618
618
|
}
|
|
619
619
|
export function rowToDoc(row) {
|
|
620
|
+
if (!Array.isArray(row) || row.length < 5) {
|
|
621
|
+
throw new Error(`rowToDoc: expected ≥5 columns, got ${Array.isArray(row) ? row.length : typeof row}`);
|
|
622
|
+
}
|
|
620
623
|
return {
|
|
621
|
-
project: row[0],
|
|
622
|
-
filename: row[1],
|
|
623
|
-
type: row[2],
|
|
624
|
-
content: row[3],
|
|
625
|
-
path: row[4],
|
|
624
|
+
project: row[0] != null ? String(row[0]) : "",
|
|
625
|
+
filename: row[1] != null ? String(row[1]) : "",
|
|
626
|
+
type: row[2] != null ? String(row[2]) : "",
|
|
627
|
+
content: row[3] != null ? String(row[3]) : "",
|
|
628
|
+
path: row[4] != null ? String(row[4]) : "",
|
|
626
629
|
};
|
|
627
630
|
}
|
|
628
631
|
export function queryDocRows(db, sql, params) {
|