Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "context-hub/generator",
"name": "ctx/ctx",
"description": "A tool for generating contextual documentation from your codebase.",
"keywords": [
"php8",
Expand All @@ -18,13 +18,10 @@
"require": {
"php": "^8.3",
"ext-curl": "*",
"guzzlehttp/guzzle": "^7.0",
"cuyz/valinor": "^1.7",
"ctx/module-research": "^1.0",
"ctx/module-config-templates": "^1.0",
"ctx/mcp-server": "^1.1",
"league/html-to-markdown": "^5.1",
"psr-discovery/http-client-implementations": "^1.0",
"psr-discovery/http-factory-implementations": "^1.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/log": "^3.0",
"symfony/finder": "^6.0 | ^7.0 | ^8.0",
"symfony/console": "^6.0 | ^7.0 | ^8.0",
Expand All @@ -39,12 +36,7 @@
"spiral/boot": "^3.15",
"spiral/files": "^3.15",
"spiral/snapshots": "^3.15",
"spiral/json-schema-generator": "^2.1",
"logiscape/mcp-sdk-php": "^1.0",
"league/route": "^6.2",
"laminas/laminas-diactoros": "^3.5",
"monolog/monolog": "^3.9",
"cocur/slugify": "^4.6"
"monolog/monolog": "^3.9"
},
"require-dev": {
"buggregator/trap": "^1.13",
Expand Down
1 change: 1 addition & 0 deletions src/Application/Bootloader/ExcludeBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Butschster\ContextGenerator\Application\Bootloader;

use Butschster\ContextGenerator\Config\ConfigLoaderBootloader;
use Butschster\ContextGenerator\Config\Exclude\ExcludeParserPlugin;
use Butschster\ContextGenerator\Config\Exclude\ExcludeRegistry;
use Butschster\ContextGenerator\Config\Exclude\ExcludeRegistryInterface;
Expand Down
1 change: 1 addition & 0 deletions src/Application/Bootloader/ModifierBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Butschster\ContextGenerator\Application\Bootloader;

use Butschster\ContextGenerator\Config\ConfigLoaderBootloader;
use Butschster\ContextGenerator\Modifier\Alias\ModifierAliasesParserPlugin;
use Butschster\ContextGenerator\Modifier\SourceModifierRegistry;
use Spiral\Boot\Bootloader\Bootloader;
Expand Down
32 changes: 0 additions & 32 deletions src/Application/Bootloader/SchemaMapperBootloader.php

This file was deleted.

1 change: 1 addition & 0 deletions src/Application/Bootloader/VariableBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Butschster\ContextGenerator\Application\Bootloader;

use Butschster\ContextGenerator\Config\ConfigLoaderBootloader;
use Butschster\ContextGenerator\Config\Parser\VariablesParserPlugin;
use Butschster\ContextGenerator\DirectoriesInterface;
use Butschster\ContextGenerator\Lib\Variable\CompositeProcessor;
Expand Down
13 changes: 0 additions & 13 deletions src/Application/JsonSchema.php

This file was deleted.

10 changes: 3 additions & 7 deletions src/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Butschster\ContextGenerator\Application;

use Butschster\ContextGenerator\Application\Bootloader\ComposerClientBootloader;
use Butschster\ContextGenerator\Application\Bootloader\ConfigLoaderBootloader;
use Butschster\ContextGenerator\Config\ConfigLoaderBootloader;
use Butschster\ContextGenerator\Application\Bootloader\ConfigurationBootloader;
use Butschster\ContextGenerator\Application\Bootloader\ConsoleBootloader;
use Butschster\ContextGenerator\Application\Bootloader\ContentRendererBootloader;
Expand All @@ -17,11 +17,10 @@
use Butschster\ContextGenerator\Application\Bootloader\HttpClientBootloader;
use Butschster\ContextGenerator\Application\Bootloader\LoggerBootloader;
use Butschster\ContextGenerator\Application\Bootloader\ModifierBootloader;
use Butschster\ContextGenerator\Application\Bootloader\SchemaMapperBootloader;
use Butschster\ContextGenerator\Application\Bootloader\SourceFetcherBootloader;
use Butschster\ContextGenerator\Application\Bootloader\VariableBootloader;
use Butschster\ContextGenerator\Research\ResearchBootloader;
use Butschster\ContextGenerator\McpServer\McpServerBootloader;
use Butschster\ContextGenerator\McpServer\ActionsBootloader;
use Butschster\ContextGenerator\Template\TemplateSystemBootloader;
use Butschster\ContextGenerator\Modifier\PhpContentFilter\PhpContentFilterBootloader;
use Butschster\ContextGenerator\Modifier\PhpDocs\PhpDocsModifierBootloader;
Expand All @@ -33,7 +32,6 @@
use Butschster\ContextGenerator\Source\GitDiff\GitDiffSourceBootloader;
use Butschster\ContextGenerator\Source\Github\GithubSourceBootloader;
use Butschster\ContextGenerator\Source\Gitlab\GitlabSourceBootloader;
use Butschster\ContextGenerator\Source\MCP\McpSourceBootloader;
use Butschster\ContextGenerator\Source\Registry\SourceRegistryBootloader;
use Butschster\ContextGenerator\Source\Text\TextSourceBootloader;
use Butschster\ContextGenerator\Source\Tree\TreeSourceBootloader;
Expand Down Expand Up @@ -88,7 +86,6 @@ protected function defineBootloaders(): array
ContentRendererBootloader::class,
SourceFetcherBootloader::class,
SourceRegistryBootloader::class,
SchemaMapperBootloader::class,

// Template System
TemplateSystemBootloader::class,
Expand All @@ -105,7 +102,6 @@ protected function defineBootloaders(): array
GitlabSourceBootloader::class,
GitDiffSourceBootloader::class,
TreeSourceBootloader::class,
McpSourceBootloader::class,
DocsSourceBootloader::class,

// Modifiers
Expand All @@ -115,7 +111,7 @@ protected function defineBootloaders(): array
SanitizerModifierBootloader::class,

// MCP Server
McpServerBootloader::class,
ActionsBootloader::class,
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Butschster\ContextGenerator\Application\Bootloader;
namespace Butschster\ContextGenerator\Config;

use Butschster\ContextGenerator\Config\Import\ImportParserPlugin;
use Butschster\ContextGenerator\Config\Import\Merger\ConfigMergerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Butschster\ContextGenerator\Application\Bootloader;
namespace Butschster\ContextGenerator\Config;

use Butschster\ContextGenerator\Application\Logger\HasPrefixLoggerInterface;
use Butschster\ContextGenerator\Config\Import\ImportParserPlugin;
Expand Down
4 changes: 2 additions & 2 deletions src/Config/context.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ documents:
- .
- ../Document
- ../Fetcher
- ../Application/Bootloader/ConfigLoaderBootloader.php
- ../Application/Bootloader/ImportBootloader.php
- ./ConfigLoaderBootloader.php
- ./ImportBootloader.php

- description: Configuration Import
outputPath: core/config-import.md
Expand Down
7 changes: 4 additions & 3 deletions src/Console/SchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Butschster\ContextGenerator\Console;

use Butschster\ContextGenerator\Application\JsonSchema;
use Butschster\ContextGenerator\DirectoriesInterface;
use Butschster\ContextGenerator\Lib\HttpClient\Exception\HttpException;
use Butschster\ContextGenerator\Lib\HttpClient\HttpClientInterface;
Expand All @@ -20,6 +19,8 @@
)]
final class SchemaCommand extends BaseCommand
{
private const string SCHEMA_URL = 'https://raw.githubusercontent.com/context-hub/generator/refs/heads/main/json-schema.json';

#[Option(
name: 'download',
shortcut: 'd',
Expand All @@ -45,7 +46,7 @@ public function __invoke(
$outputPath = (string) $dirs->getRootPath()->join($this->outputPath);

// Always show the URL where the schema is hosted
$this->output->info('JSON schema URL: ' . JsonSchema::SCHEMA_URL);
$this->output->info('JSON schema URL: ' . self::SCHEMA_URL);

// If no download requested, exit early
if (!$this->download) {
Expand All @@ -55,7 +56,7 @@ public function __invoke(

// Download and save the schema
try {
$response = $httpClient->get(JsonSchema::SCHEMA_URL, [
$response = $httpClient->get(self::SCHEMA_URL, [
'User-Agent' => 'Context-Generator-Schema-Download',
'Accept' => 'application/json',
]);
Expand Down
20 changes: 0 additions & 20 deletions src/Lib/SchemaMapper/SchemaMapperInterface.php

This file was deleted.

29 changes: 0 additions & 29 deletions src/Lib/SchemaMapper/Valinor/MapperBuilder.php

This file was deleted.

36 changes: 0 additions & 36 deletions src/Lib/SchemaMapper/Valinor/SchemaMapper.php

This file was deleted.

10 changes: 5 additions & 5 deletions src/McpServer/Action/Prompts/FilesystemOperationsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use Butschster\ContextGenerator\Application\Logger\LoggerPrefix;
use Butschster\ContextGenerator\McpServer\Attribute\Prompt;
use Butschster\ContextGenerator\McpServer\Routing\Attribute\Get;
use Mcp\Types\GetPromptResult;
use Mcp\Types\PromptMessage;
use Mcp\Types\Role;
use Mcp\Types\TextContent;
use PhpMcp\Schema\Content\PromptMessage;
use PhpMcp\Schema\Content\TextContent;
use PhpMcp\Schema\Enum\Role;
use PhpMcp\Schema\Result\GetPromptResult;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -40,7 +40,7 @@ public function __invoke(ServerRequestInterface $request): GetPromptResult
return new GetPromptResult(
messages: [
new PromptMessage(
role: Role::USER,
role: Role::User,
content: new TextContent(
text: \implode("\n", $rules),
),
Expand Down
4 changes: 2 additions & 2 deletions src/McpServer/Action/Prompts/GetPromptAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Butschster\ContextGenerator\Application\Logger\LoggerPrefix;
use Butschster\ContextGenerator\McpServer\Prompt\PromptProviderInterface;
use Butschster\ContextGenerator\McpServer\Routing\Attribute\Get;
use Mcp\Types\GetPromptResult;
use PhpMcp\Schema\Result\GetPromptResult;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;

Expand All @@ -26,7 +26,7 @@ public function __invoke(ServerRequestInterface $request): GetPromptResult
$this->logger->info('Getting prompt', ['id' => $id]);

if (!$this->prompts->has($id)) {
return new GetPromptResult([]);
return new GetPromptResult(messages: []);
}

$prompt = $this->prompts->get($id, $request->getAttributes());
Expand Down
8 changes: 4 additions & 4 deletions src/McpServer/Action/Prompts/ListPromptsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Butschster\ContextGenerator\Application\Logger\LoggerPrefix;
use Butschster\ContextGenerator\Config\Loader\ConfigLoaderInterface;
use Butschster\ContextGenerator\McpServer\Prompt\PromptProviderInterface;
use Butschster\ContextGenerator\McpServer\Registry\McpItemsRegistry;
use Butschster\ContextGenerator\McpServer\Routing\Attribute\Get;
use Mcp\Types\ListPromptsResult;
use Mcp\Server\Contracts\ReferenceProviderInterface;
use PhpMcp\Schema\Result\ListPromptsResult;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;

Expand All @@ -18,7 +18,7 @@
public function __construct(
#[LoggerPrefix(prefix: 'prompts.list')]
private LoggerInterface $logger,
private McpItemsRegistry $registry,
private ReferenceProviderInterface $provider,
private PromptProviderInterface $prompts,
private ConfigLoaderInterface $configLoader,
) {}
Expand All @@ -30,7 +30,7 @@ public function __invoke(ServerRequestInterface $request): ListPromptsResult
$this->logger->info('Listing available prompts');

$prompts = [];
foreach ($this->registry->getPrompts() as $prompt) {
foreach ($this->provider->getPrompts() as $prompt) {
$prompts[] = $prompt;
}

Expand Down
Loading
Loading