Skip to content

Commit 093865d

Browse files
authored
Merge pull request #4: Add Prompt finder
2 parents 81b12f3 + 3c070b9 commit 093865d

32 files changed

+631
-173
lines changed

ai.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!-- Example -->
33
<ai
4-
temp-dir="./runtime"
4+
cache-dir="./runtime/.ai"
55
>
66
<source>
77
<include>

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"psr/container": "^2.0",
2626
"psr/log": "^3.0.1",
2727
"psr/simple-cache": "^3.0",
28-
"symfony/finder": "^7.1"
28+
"symfony/finder": "^7.1",
29+
"yiisoft/cache-file": "^3.1",
30+
"yiisoft/injector": "^1.2"
2931
},
3032
"require-dev": {
3133
"buggregator/trap": "^1.10",

composer.lock

Lines changed: 151 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

psalm-baseline.xml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505">
3-
<file src="src/Service/Container/ContainerImpl.php">
3+
<file src="src/Module/Finder/Internal/PromptFinderImpl.php">
4+
<MixedInferredReturnType>
5+
<code><![CDATA[PromptCache]]></code>
6+
</MixedInferredReturnType>
7+
<MixedReturnStatement>
8+
<code><![CDATA[$this->cache->get(self::CACHE_KEY) ?? new PromptCache()]]></code>
9+
<code><![CDATA[$this->cache->get(self::CACHE_KEY) ?? new PromptCache()]]></code>
10+
</MixedReturnStatement>
11+
</file>
12+
<file src="src/Service/Factoriable.php">
13+
<InvalidDocblock>
14+
<code><![CDATA[Factoriable]]></code>
15+
</InvalidDocblock>
16+
</file>
17+
<file src="src/Service/Internal/Cache/PsrCache.php">
18+
<MixedAssignment>
19+
<code><![CDATA[$value]]></code>
20+
<code><![CDATA[$value]]></code>
21+
</MixedAssignment>
22+
</file>
23+
<file src="src/Service/Internal/Container/ContainerImpl.php">
424
<InvalidReturnType>
525
<code><![CDATA[object]]></code>
626
</InvalidReturnType>
727
</file>
8-
<file src="src/Service/Container/Injection/ConfigLoader.php">
28+
<file src="src/Service/Internal/Container/Injection/ConfigLoader.php">
929
<MixedMethodCall>
1030
<code><![CDATA[new $attribute->class()]]></code>
1131
</MixedMethodCall>
1232
<RedundantCondition>
1333
<code><![CDATA[\assert($xml instanceof \SimpleXMLElement)]]></code>
1434
</RedundantCondition>
1535
</file>
16-
<file src="src/Service/Factoriable.php">
17-
<InvalidDocblock>
18-
<code><![CDATA[Factoriable]]></code>
19-
</InvalidDocblock>
20-
</file>
2136
</files>

src/Bootstrap.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
namespace LLM\Assistant;
66

7-
use LLM\Assistant\Module\Finder\Finder;
8-
use LLM\Assistant\Module\Finder\Internal\FinderImpl;
7+
use LLM\Assistant\Module\Finder\FilesystemFinder;
8+
use LLM\Assistant\Module\Finder\Internal\FilesystemFinderImpl;
9+
use LLM\Assistant\Module\Finder\Internal\PromptFinderImpl;
10+
use LLM\Assistant\Module\Finder\PromptFinder;
11+
use LLM\Assistant\Service\Cache;
912
use LLM\Assistant\Service\Container;
10-
use LLM\Assistant\Service\Container\ContainerImpl;
11-
use LLM\Assistant\Service\Container\Injection\ConfigLoader;
13+
use LLM\Assistant\Service\Internal\Cache\PsrCache;
14+
use LLM\Assistant\Service\Internal\Container\ContainerImpl;
15+
use LLM\Assistant\Service\Internal\Container\Injection\ConfigLoader;
16+
use LLM\Assistant\Service\Internal\Logger\LoggerImpl;
1217
use LLM\Assistant\Service\Logger;
13-
use LLM\Assistant\Service\Logger\LoggerImpl;
1418
use Symfony\Component\Console\Input\InputInterface;
1519
use Symfony\Component\Console\Output\OutputInterface;
1620
use Symfony\Component\Console\Style\StyleInterface;
@@ -44,7 +48,9 @@ public function finish(): Container
4448
$c = $this->container;
4549
unset($this->container);
4650

47-
$c->bind(Finder::class, FinderImpl::class);
51+
$c->bind(FilesystemFinder::class, FilesystemFinderImpl::class);
52+
$c->bind(PromptFinder::class, PromptFinderImpl::class);
53+
$c->bind(Cache::class, PsrCache::class);
4854

4955
return $c;
5056
}

src/Command/Run.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace LLM\Assistant\Command;
66

7-
use LLM\Assistant\Module\Finder\Finder;
7+
use LLM\Assistant\Module\Finder\PromptFinder;
88
use Symfony\Component\Console\Attribute\AsCommand;
99
use Symfony\Component\Console\Command\Command;
1010
use Symfony\Component\Console\Input\InputInterface;
@@ -32,11 +32,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3232

3333
$this->logger->alert('Assistant is running');
3434

35-
$finder = $this->container->get(Finder::class);
35+
$finder = $this->container->get(PromptFinder::class);
3636

37-
foreach ($finder->files() as $name => $file) {
38-
$this->logger->info($name);
39-
}
37+
#AI test
38+
tr($finder->getNext());
39+
40+
// foreach ($finder->files() as $name => $file) {
41+
// $this->logger->info($name);
42+
// }
4043

4144
return Command::SUCCESS;
4245
}

src/Service/Container/Attribute/ConfigAttribute.php renamed to src/Config/Attribute/ConfigAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace LLM\Assistant\Service\Container\Attribute;
5+
namespace LLM\Assistant\Config\Attribute;
66

77
/**
88
* @internal

src/Service/Container/Attribute/Env.php renamed to src/Config/Attribute/Env.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace LLM\Assistant\Service\Container\Attribute;
5+
namespace LLM\Assistant\Config\Attribute;
66

77
/**
88
* @internal

src/Service/Container/Attribute/InputArgument.php renamed to src/Config/Attribute/InputArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace LLM\Assistant\Service\Container\Attribute;
5+
namespace LLM\Assistant\Config\Attribute;
66

77
/**
88
* @internal

0 commit comments

Comments
 (0)