refactor: убрать дубли, развести слои, разбить тесты
- Support/FileWalker: один обход каталога вместо двух копий - Support/Bytes: форматирование размера вместо трёх копий - Support/UrlGuard: SSRF-проверки вынесены из HttpRequestTool - Support/AtomicWriter: запись вынесена из FileSandbox - HttpRequest: normalizeUrl/resolveRedirect — одна реализация URL-логики - AiClient поверх HttpTransport::request: один транспорт, одна TLS-логика (было две копии cURL-настроек), подсказка про AI_CAINFO переехала в HttpTransport - Http переименован в HttpTransport: транспорт/значение/инструмент больше не называются одинаково - Agent: удалён мёртвый withDefaults — ядро больше не зависит от tools - tests: раннер + support + cases по темам (agent, files, http, shell, logging, tools, architecture) - архитектурные тесты: src не импортирует Tools, tools не создают AiClient и не вызывают cURL напрямую - 100 тестов
This commit is contained in:
1 parent
74bb23c159
commit
76b3be7115
28 files changed
+2022
-1749
No files matched your search
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace AiSdk\Tools;
|
||||
|
||||
use AiSdk\Tool;
|
||||
use AiSdk\Tools\Support\AtomicWriter;
|
||||
|
||||
/**
|
||||
* Точечная замена в файле: старый фрагмент -> новый.
|
||||
@@ -94,7 +95,7 @@ final class ReplaceInFileTool implements Tool
|
||||
: $this->replaceOnce($content, $search, $replace);
|
||||
|
||||
try {
|
||||
$this->sandbox->writeAtomic($file, $updated);
|
||||
AtomicWriter::write($file, $updated);
|
||||
} catch (\RuntimeException $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
@@ -118,3 +119,4 @@ final class ReplaceInFileTool implements Tool
|
||||
return substr_replace($content, $replace, $position, strlen($search));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user