Skip to content

Commit 0f24155

Browse files
authored
Merge pull request #203 from context-hub/issue/160
Dynamic Project Switching for MCP Server
2 parents 9e60ec0 + 523ab7b commit 0f24155

34 files changed

+1946
-541
lines changed

app.php

+8
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,19 @@
9292
// Execute Application
9393
// -----------------------------------------------------------------------------
9494

95+
// Determine appropriate location for global state based on OS
96+
$globalStateDir = match (PHP_OS_FAMILY) {
97+
'Windows' => \getenv('APPDATA') . '/CTX',
98+
'Darwin' => $_SERVER['HOME'] . '/Library/Application Support/CTX',
99+
default => $_SERVER['HOME'] . '/.config/ctx',
100+
};
101+
95102
$app = Kernel::create(
96103
directories: [
97104
'root' => $appPath,
98105
'output' => $appPath . '/.context',
99106
'config' => $appPath,
107+
'global-state' => $globalStateDir,
100108
'json-schema' => __DIR__,
101109
],
102110
exceptionHandler: ExceptionHandler::class,

src/Application/Bootloader/CoreBootloader.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Butschster\ContextGenerator\Application\Bootloader;
66

7-
use Butschster\ContextGenerator\Console\DisplayCommand;
87
use Butschster\ContextGenerator\Console\GenerateCommand;
98
use Butschster\ContextGenerator\Console\InitCommand;
109
use Butschster\ContextGenerator\Console\SchemaCommand;
@@ -58,7 +57,6 @@ public function boot(ConsoleBootloader $console): void
5857
SchemaCommand::class,
5958
SelfUpdateCommand::class,
6059
GenerateCommand::class,
61-
DisplayCommand::class,
6260
);
6361
}
6462

src/Application/Kernel.php

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Butschster\ContextGenerator\Application\Bootloader\SourceFetcherBootloader;
1919
use Butschster\ContextGenerator\Application\Bootloader\VariableBootloader;
2020
use Butschster\ContextGenerator\McpServer\McpServerBootloader;
21-
use Butschster\ContextGenerator\McpServer\Prompt\McpPromptBootloader;
2221
use Butschster\ContextGenerator\Modifier\PhpContentFilter\PhpContentFilterBootloader;
2322
use Butschster\ContextGenerator\Modifier\PhpDocs\PhpDocsModifierBootloader;
2423
use Butschster\ContextGenerator\Modifier\PhpSignature\PhpSignatureModifierBootloader;
@@ -83,7 +82,6 @@ protected function defineBootloaders(): array
8382

8483
// MCP Server
8584
McpServerBootloader::class,
86-
McpPromptBootloader::class,
8785
];
8886
}
8987

src/Config/Import/Merger/VariablesConfigMerger.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#[LoggerPrefix(prefix: 'variables-merger')]
1111
final readonly class VariablesConfigMerger extends AbstractConfigMerger
1212
{
13-
protected function performMerge(array $mainSection, array $importedSection, ImportedConfig $importedConfig): array
13+
public function getConfigKey(): string
1414
{
15-
// Merge the variables from the imported config into the main config
16-
return [...$importedSection, ...$mainSection];
15+
return 'variables';
1716
}
1817

19-
public function getConfigKey(): string
18+
protected function performMerge(array $mainSection, array $importedSection, ImportedConfig $importedConfig): array
2019
{
21-
return 'variables';
20+
// Merge the variables from the imported config into the main config
21+
return [...$importedSection, ...$mainSection];
2222
}
2323
}

src/Config/Loader/ConfigLoaderFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
public function create(string $configPath): ConfigLoaderInterface
3131
{
3232
$dirs = $this->dirs->withConfigPath($configPath);
33-
$configPathObj = $dirs->getConfigPath();
33+
$configPathObj = $dirs->getRootPath();
3434

3535
// Create composite parser using the injected plugin registry
3636
$compositeParser = new CompositeConfigParser(

src/Console/DisplayCommand.php

-113
This file was deleted.

src/Console/Renderer/ConfigRendererInterface.php

-21
This file was deleted.

src/Console/Renderer/DocumentRenderer.php

-31
This file was deleted.

src/Console/Renderer/ModifierRenderer.php

-43
This file was deleted.

0 commit comments

Comments
 (0)