@renseiai/agentfactory-code-intelligence 0.8.18 → 0.8.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-intelligence-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/code-intelligence-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAchF,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAA;CACrE;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ;
|
|
1
|
+
{"version":3,"file":"code-intelligence-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/code-intelligence-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAchF,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAA;CACrE;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ;AA2SD,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB,EAAE,UA6JpC,CAAA"}
|
|
@@ -104,6 +104,59 @@ async function findTypeUsagesInProcess(cwd, typeName, maxResults) {
|
|
|
104
104
|
mappingObjects: usages.filter(u => u.kind === 'mapping_object').length,
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
+
function isRealImportLine(line, state) {
|
|
108
|
+
const trimmed = line.trim();
|
|
109
|
+
if (state.inBlockComment) {
|
|
110
|
+
if (trimmed.includes('*/')) {
|
|
111
|
+
return { real: false, state: { ...state, inBlockComment: false } };
|
|
112
|
+
}
|
|
113
|
+
return { real: false, state };
|
|
114
|
+
}
|
|
115
|
+
if (trimmed.startsWith('/*')) {
|
|
116
|
+
const closesOnSameLine = trimmed.includes('*/');
|
|
117
|
+
return { real: false, state: { ...state, inBlockComment: !closesOnSameLine } };
|
|
118
|
+
}
|
|
119
|
+
if (state.inTemplateLiteral) {
|
|
120
|
+
const backtickCount = countUnescapedBackticks(line);
|
|
121
|
+
if (backtickCount % 2 === 1) {
|
|
122
|
+
return { real: false, state: { ...state, inTemplateLiteral: false } };
|
|
123
|
+
}
|
|
124
|
+
return { real: false, state };
|
|
125
|
+
}
|
|
126
|
+
if (trimmed.startsWith('//') || trimmed.startsWith('*'))
|
|
127
|
+
return { real: false, state };
|
|
128
|
+
const backticks = countUnescapedBackticks(line);
|
|
129
|
+
if (backticks % 2 === 1) {
|
|
130
|
+
const importIdx = line.search(/\b(import|export)\s/);
|
|
131
|
+
const firstBacktick = line.indexOf('`');
|
|
132
|
+
if (importIdx >= 0 && firstBacktick >= 0 && importIdx > firstBacktick) {
|
|
133
|
+
return { real: false, state: { ...state, inTemplateLiteral: true } };
|
|
134
|
+
}
|
|
135
|
+
if (importIdx >= 0 && (firstBacktick < 0 || importIdx < firstBacktick)) {
|
|
136
|
+
return { real: true, state: { ...state, inTemplateLiteral: true } };
|
|
137
|
+
}
|
|
138
|
+
return { real: false, state: { ...state, inTemplateLiteral: true } };
|
|
139
|
+
}
|
|
140
|
+
if (/^\s*(import|export)\s/.test(line))
|
|
141
|
+
return { real: true, state };
|
|
142
|
+
if (/\brequire\s*\(/.test(line)) {
|
|
143
|
+
const reqIdx = line.indexOf('require');
|
|
144
|
+
const beforeReq = line.slice(0, reqIdx);
|
|
145
|
+
if (beforeReq.includes('`') || beforeReq.includes("'require") || beforeReq.includes('"require')) {
|
|
146
|
+
return { real: false, state };
|
|
147
|
+
}
|
|
148
|
+
return { real: true, state };
|
|
149
|
+
}
|
|
150
|
+
return { real: false, state };
|
|
151
|
+
}
|
|
152
|
+
function countUnescapedBackticks(line) {
|
|
153
|
+
let count = 0;
|
|
154
|
+
for (let i = 0; i < line.length; i++) {
|
|
155
|
+
if (line[i] === '`' && (i === 0 || line[i - 1] !== '\\'))
|
|
156
|
+
count++;
|
|
157
|
+
}
|
|
158
|
+
return count;
|
|
159
|
+
}
|
|
107
160
|
// ── In-process cross-package dep validator ──────────────────────────────────
|
|
108
161
|
async function validateCrossDepsInProcess(cwd, targetPath) {
|
|
109
162
|
const files = await discoverFiles(cwd);
|
|
@@ -163,7 +216,12 @@ async function validateCrossDepsInProcess(cwd, targetPath) {
|
|
|
163
216
|
if (!owningPkg)
|
|
164
217
|
continue;
|
|
165
218
|
const lines = content.split('\n');
|
|
219
|
+
let parseState = { inBlockComment: false, inTemplateLiteral: false };
|
|
166
220
|
for (let i = 0; i < lines.length; i++) {
|
|
221
|
+
const classification = isRealImportLine(lines[i], parseState);
|
|
222
|
+
parseState = classification.state;
|
|
223
|
+
if (!classification.real)
|
|
224
|
+
continue;
|
|
167
225
|
const importMatch = lines[i].match(/(?:from\s+['"]|require\s*\(\s*['"]|import\s+['"])(@[^'"\/]+\/[^'"\/]+|[^.'"\/@][^'"\/]*)/);
|
|
168
226
|
if (!importMatch)
|
|
169
227
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@renseiai/agentfactory-code-intelligence",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Code intelligence for AgentFactory — tree-sitter AST parsing, BM25 search, incremental indexing, memory deduplication",
|
|
6
6
|
"author": "Rensei AI (https://rensei.ai)",
|