archicore 0.3.8 → 0.3.9
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.
|
@@ -600,7 +600,7 @@ async function handleIndexCommand() {
|
|
|
600
600
|
const codeIndex = new CodeIndex(state.projectPath);
|
|
601
601
|
// Проверяем, является ли проект bundled (содержит source maps)
|
|
602
602
|
const isBundled = await codeIndex.isBundledProject();
|
|
603
|
-
let asts;
|
|
603
|
+
let asts = new Map();
|
|
604
604
|
let virtualFileContents = [];
|
|
605
605
|
if (isBundled) {
|
|
606
606
|
// Извлекаем исходники из source maps
|
|
@@ -608,17 +608,31 @@ async function handleIndexCommand() {
|
|
|
608
608
|
const extractionResult = await codeIndex.extractFromSourceMaps();
|
|
609
609
|
if (extractionResult.files.length > 0) {
|
|
610
610
|
indexSpinner.update(`Extracted ${extractionResult.files.length} files from source maps, parsing...`);
|
|
611
|
-
// Парсим виртуальные файлы
|
|
611
|
+
// Парсим виртуальные файлы из source maps
|
|
612
612
|
asts = codeIndex.parseVirtualFiles(extractionResult.files);
|
|
613
613
|
// Сохраняем содержимое виртуальных файлов для загрузки
|
|
614
614
|
virtualFileContents = extractionResult.files.map(f => [f.path, f.content]);
|
|
615
|
-
indexSpinner.update(`Parsed ${asts.size} files from source maps
|
|
615
|
+
indexSpinner.update(`Parsed ${asts.size} virtual files from source maps`);
|
|
616
616
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
617
|
+
// ВАЖНО: Также парсим PHP/Python/другие backend файлы (не JS бандлы)
|
|
618
|
+
indexSpinner.update('Also parsing backend files (PHP, Python, etc.)...');
|
|
619
|
+
const backendAsts = await codeIndex.parseProject();
|
|
620
|
+
// Объединяем: source maps + backend файлы (исключая bundled JS)
|
|
621
|
+
let addedBackendFiles = 0;
|
|
622
|
+
for (const [path, ast] of backendAsts) {
|
|
623
|
+
// Пропускаем bundled JS файлы - они уже извлечены из source maps
|
|
624
|
+
const isBundledJs = path.match(/\.(min\.js|bundle\.js)$/) ||
|
|
625
|
+
path.match(/\/(dist|build|vendor)\//i) ||
|
|
626
|
+
path.match(/\.(js|ts)$/) && path.match(/\d+\.[a-f0-9]+\.(js|ts)$/i);
|
|
627
|
+
if (!isBundledJs && !asts.has(path)) {
|
|
628
|
+
asts.set(path, ast);
|
|
629
|
+
addedBackendFiles++;
|
|
630
|
+
}
|
|
621
631
|
}
|
|
632
|
+
if (addedBackendFiles > 0) {
|
|
633
|
+
indexSpinner.update(`Added ${addedBackendFiles} backend files (PHP, Python, etc.)`);
|
|
634
|
+
}
|
|
635
|
+
indexSpinner.update(`Total: ${asts.size} files (source maps + backend)`);
|
|
622
636
|
}
|
|
623
637
|
else {
|
|
624
638
|
// Обычный проект - парсим файлы напрямую
|
|
@@ -635,25 +649,38 @@ async function handleIndexCommand() {
|
|
|
635
649
|
const isLargeProject = symbols.size > 50000 || asts.size > 1000;
|
|
636
650
|
// Читаем содержимое файлов (с оптимизацией для больших проектов)
|
|
637
651
|
let fileContents = [];
|
|
638
|
-
|
|
652
|
+
const virtualFilePaths = new Set(virtualFileContents.map(([path]) => path));
|
|
653
|
+
// Добавляем виртуальные файлы из source maps
|
|
639
654
|
if (virtualFileContents.length > 0) {
|
|
640
|
-
indexSpinner.update('Using extracted source files...');
|
|
641
|
-
fileContents = virtualFileContents;
|
|
655
|
+
indexSpinner.update('Using extracted source files from source maps...');
|
|
656
|
+
fileContents = [...virtualFileContents];
|
|
642
657
|
}
|
|
643
|
-
|
|
644
|
-
|
|
658
|
+
// Также читаем backend файлы (PHP, Python и т.д.) которых нет в source maps
|
|
659
|
+
if (!isLargeProject) {
|
|
660
|
+
indexSpinner.update('Reading backend file contents (PHP, Python, etc.)...');
|
|
661
|
+
let backendFilesRead = 0;
|
|
645
662
|
for (const [filePath] of asts) {
|
|
663
|
+
// Пропускаем файлы которые уже есть из source maps
|
|
664
|
+
if (virtualFilePaths.has(filePath))
|
|
665
|
+
continue;
|
|
666
|
+
// Пропускаем bundled JS файлы
|
|
667
|
+
if (filePath.match(/\d+\.[a-f0-9]+\.(js|ts)$/i))
|
|
668
|
+
continue;
|
|
646
669
|
try {
|
|
647
670
|
const fullPath = pathModule.default.isAbsolute(filePath)
|
|
648
671
|
? filePath
|
|
649
672
|
: pathModule.default.join(state.projectPath, filePath);
|
|
650
673
|
const content = await fs.readFile(fullPath, 'utf-8');
|
|
651
674
|
fileContents.push([filePath, content]);
|
|
675
|
+
backendFilesRead++;
|
|
652
676
|
}
|
|
653
677
|
catch {
|
|
654
678
|
// Игнорируем ошибки чтения отдельных файлов
|
|
655
679
|
}
|
|
656
680
|
}
|
|
681
|
+
if (backendFilesRead > 0) {
|
|
682
|
+
indexSpinner.update(`Read ${backendFilesRead} additional backend files`);
|
|
683
|
+
}
|
|
657
684
|
}
|
|
658
685
|
else {
|
|
659
686
|
indexSpinner.update('Large project detected, skipping file contents for faster upload...');
|
|
@@ -868,7 +895,7 @@ async function handleAnalyzeCommand(args) {
|
|
|
868
895
|
async function handleSearchCommand(query) {
|
|
869
896
|
if (!state.projectId) {
|
|
870
897
|
printError('No project selected');
|
|
871
|
-
printInfo('Use /
|
|
898
|
+
printInfo('Use /index first to register the project');
|
|
872
899
|
return;
|
|
873
900
|
}
|
|
874
901
|
if (!query) {
|
|
@@ -915,7 +942,7 @@ async function handleSearchCommand(query) {
|
|
|
915
942
|
async function handleQuery(query) {
|
|
916
943
|
if (!state.projectId) {
|
|
917
944
|
printError('No project selected');
|
|
918
|
-
printInfo('Use /
|
|
945
|
+
printInfo('Use /index first to register the project');
|
|
919
946
|
return;
|
|
920
947
|
}
|
|
921
948
|
// Save user message to history
|
package/dist/cli.js
CHANGED
|
@@ -56,7 +56,7 @@ program
|
|
|
56
56
|
provider: 'deepseek',
|
|
57
57
|
model: 'deepseek-chat',
|
|
58
58
|
temperature: 0.1,
|
|
59
|
-
maxTokens:
|
|
59
|
+
maxTokens: 8192
|
|
60
60
|
},
|
|
61
61
|
vectorStore: {
|
|
62
62
|
url: process.env.QDRANT_URL || 'http://localhost:6333',
|
|
@@ -107,7 +107,7 @@ program
|
|
|
107
107
|
provider: 'deepseek',
|
|
108
108
|
model: 'deepseek-chat',
|
|
109
109
|
temperature: 0.1,
|
|
110
|
-
maxTokens:
|
|
110
|
+
maxTokens: 8192
|
|
111
111
|
},
|
|
112
112
|
vectorStore: {
|
|
113
113
|
url: process.env.QDRANT_URL || 'http://localhost:6333',
|
|
@@ -192,7 +192,7 @@ program
|
|
|
192
192
|
provider: 'deepseek',
|
|
193
193
|
model: 'deepseek-chat',
|
|
194
194
|
temperature: 0.1,
|
|
195
|
-
maxTokens:
|
|
195
|
+
maxTokens: 8192
|
|
196
196
|
},
|
|
197
197
|
vectorStore: {
|
|
198
198
|
url: process.env.QDRANT_URL || 'http://localhost:6333',
|
|
@@ -230,7 +230,7 @@ program
|
|
|
230
230
|
provider: 'deepseek',
|
|
231
231
|
model: 'deepseek-chat',
|
|
232
232
|
temperature: 0.3,
|
|
233
|
-
maxTokens:
|
|
233
|
+
maxTokens: 8192
|
|
234
234
|
},
|
|
235
235
|
vectorStore: {
|
|
236
236
|
url: process.env.QDRANT_URL || 'http://localhost:6333',
|
|
@@ -136,7 +136,12 @@ router.get('/verify/:userCode', (req, res) => {
|
|
|
136
136
|
* Authorize device (called from web after user logs in)
|
|
137
137
|
*/
|
|
138
138
|
router.post('/authorize', async (req, res) => {
|
|
139
|
-
const { userCode, userId,
|
|
139
|
+
const { userCode, userId, action } = req.body;
|
|
140
|
+
// Get access token from cookie or Authorization header (not from body!)
|
|
141
|
+
// Web frontend sends credentials: 'include' which sends the httpOnly cookie
|
|
142
|
+
const accessToken = req.cookies?.archicore_token ||
|
|
143
|
+
req.headers.authorization?.substring(7) ||
|
|
144
|
+
req.body.accessToken; // Fallback to body for backwards compatibility
|
|
140
145
|
if (!userCode) {
|
|
141
146
|
res.status(400).json({ error: 'invalid_request', message: 'Missing user_code' });
|
|
142
147
|
return;
|
|
@@ -178,7 +178,7 @@ export class ProjectService {
|
|
|
178
178
|
provider: 'deepseek',
|
|
179
179
|
model: process.env.DEEPSEEK_MODEL || 'deepseek-chat',
|
|
180
180
|
temperature: 0.1,
|
|
181
|
-
maxTokens:
|
|
181
|
+
maxTokens: 8192,
|
|
182
182
|
baseURL: 'https://api.deepseek.com'
|
|
183
183
|
};
|
|
184
184
|
// SemanticMemory - поддержка Jina (бесплатно) или OpenAI
|