From 3b64475ff6f3a8accff3390d2ac50ff682750a55 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 9 Sep 2025 07:19:43 +0200 Subject: [PATCH 1/2] feature [Store] Add optional description to Indexer for better command output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add defaultNull description parameter to IndexerInterface and Indexer class. The ai:store:index command now displays the description when available. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/store/src/Command/IndexCommand.php | 5 +++++ src/store/src/Indexer.php | 8 +++++++- src/store/src/IndexerInterface.php | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/store/src/Command/IndexCommand.php b/src/store/src/Command/IndexCommand.php index 97ae1fae9..1d70a5e10 100644 --- a/src/store/src/Command/IndexCommand.php +++ b/src/store/src/Command/IndexCommand.php @@ -96,6 +96,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->title(\sprintf('Indexing documents using "%s" indexer', $indexer)); + $description = $indexerService->getDescription(); + if (null !== $description) { + $io->info($description); + } + try { $indexerService->index([]); diff --git a/src/store/src/Indexer.php b/src/store/src/Indexer.php index e368ba178..4dec3e17f 100644 --- a/src/store/src/Indexer.php +++ b/src/store/src/Indexer.php @@ -40,13 +40,14 @@ public function __construct( string|array|null $source = null, private array $transformers = [], private LoggerInterface $logger = new NullLogger(), + private ?string $description = null, ) { $this->sources = null === $source ? [] : (array) $source; } public function withSource(string|array $source): self { - return new self($this->loader, $this->vectorizer, $this->store, $source, $this->transformers, $this->logger); + return new self($this->loader, $this->vectorizer, $this->store, $source, $this->transformers, $this->logger, $this->description); } public function index(array $options = []): void @@ -96,6 +97,11 @@ public function index(array $options = []): void $this->logger->debug('Document processing completed', ['total_documents' => $counter]); } + public function getDescription(): ?string + { + return $this->description; + } + /** * @return TextDocument[] */ diff --git a/src/store/src/IndexerInterface.php b/src/store/src/IndexerInterface.php index fcb27494f..b4e2c9863 100644 --- a/src/store/src/IndexerInterface.php +++ b/src/store/src/IndexerInterface.php @@ -31,4 +31,9 @@ public function index(array $options = []): void; * @param string|array $source Source identifier (file path, URL, etc.) or array of sources */ public function withSource(string|array $source): self; + + /** + * Get the description of what this indexer does. + */ + public function getDescription(): ?string; } From 5a3c1e5398398fbe0d3b167ac5d612b73d87d4a2 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 9 Sep 2025 07:24:46 +0200 Subject: [PATCH 2/2] fix [Store] Correct parameter order in Indexer constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place description parameter before logger to maintain consistency with existing constructor parameter pattern. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/store/src/Indexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/src/Indexer.php b/src/store/src/Indexer.php index 4dec3e17f..c541be318 100644 --- a/src/store/src/Indexer.php +++ b/src/store/src/Indexer.php @@ -39,15 +39,15 @@ public function __construct( private StoreInterface $store, string|array|null $source = null, private array $transformers = [], - private LoggerInterface $logger = new NullLogger(), private ?string $description = null, + private LoggerInterface $logger = new NullLogger(), ) { $this->sources = null === $source ? [] : (array) $source; } public function withSource(string|array $source): self { - return new self($this->loader, $this->vectorizer, $this->store, $source, $this->transformers, $this->logger, $this->description); + return new self($this->loader, $this->vectorizer, $this->store, $source, $this->transformers, $this->description, $this->logger); } public function index(array $options = []): void