From 461ed91f50436863d6a8ae977cbcd0b55aa61b36 Mon Sep 17 00:00:00 2001 From: olaru Date: Thu, 10 Sep 2026 11:13:38 +0300 Subject: [PATCH 1/5] extend Link header --- config/pipeline.php | 4 +- src/App/src/ConfigProvider.php | 3 + .../ServiceDocLinkMiddlewareFactory.php | 16 +++ .../Middleware/ServiceDocLinkMiddleware.php | 57 ++++++++ .../ServiceDocLinkMiddlewareTest.php | 127 ++++++++++++++++++ 5 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php create mode 100644 src/App/src/Middleware/ServiceDocLinkMiddleware.php create mode 100644 test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php diff --git a/config/pipeline.php b/config/pipeline.php index ba6c27c9..4aeb4236 100644 --- a/config/pipeline.php +++ b/config/pipeline.php @@ -4,6 +4,7 @@ use Dot\ErrorHandler\ErrorHandlerInterface; use Dot\ResponseHeader\Middleware\ResponseHeaderMiddleware; +use Light\App\Middleware\ServiceDocLinkMiddleware; use Mezzio\Application; use Mezzio\Handler\NotFoundHandler; use Mezzio\Helper\ServerUrlMiddleware; @@ -41,7 +42,6 @@ // Register the routing middleware in the middleware pipeline. // This middleware registers the Mezzio\Router\RouteResult request attribute. $app->pipe(RouteMiddleware::class); - $app->pipe(ResponseHeaderMiddleware::class); // The following handle routing failures for common conditions: // - HEAD request but no routes answer that method @@ -52,6 +52,8 @@ $app->pipe(ImplicitHeadMiddleware::class); $app->pipe(ImplicitOptionsMiddleware::class); $app->pipe(MethodNotAllowedMiddleware::class); + $app->pipe(ServiceDocLinkMiddleware::class); + $app->pipe(ResponseHeaderMiddleware::class); // Seed the UrlHelper with the routing results: $app->pipe(UrlHelperMiddleware::class); diff --git a/src/App/src/ConfigProvider.php b/src/App/src/ConfigProvider.php index 965448c3..59e0e741 100644 --- a/src/App/src/ConfigProvider.php +++ b/src/App/src/ConfigProvider.php @@ -24,12 +24,14 @@ use Light\App\Factory\MarkdownExtensionFactory; use Light\App\Factory\MarkdownRuntimeLoaderFactory; use Light\App\Factory\PackageGeneratorFactory; +use Light\App\Factory\ServiceDocLinkMiddlewareFactory; use Light\App\Factory\SitemapGeneratorFactory; use Light\App\Handler\GetFeedViewHandler; use Light\App\Handler\GetIndexViewHandler; use Light\App\Handler\GetMarkdownArticleHandler; use Light\App\Handler\GetPackagesViewHandler; use Light\App\Handler\GetSitemapViewHandler; +use Light\App\Middleware\ServiceDocLinkMiddleware; use Light\App\Resolver\EntityListenerResolver; use Light\App\Service\FeedGenerator; use Light\App\Service\GitHubClient; @@ -150,6 +152,7 @@ public function getDependencies(): array LlmsGenerator::class => LlmsGeneratorFactory::class, MarkdownExtension::class => MarkdownExtensionFactory::class, RuntimeLoaderInterface::class => MarkdownRuntimeLoaderFactory::class, + ServiceDocLinkMiddleware::class => ServiceDocLinkMiddlewareFactory::class, ], 'aliases' => [ EntityManager::class => 'doctrine.entity_manager.orm_default', diff --git a/src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php b/src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php new file mode 100644 index 00000000..4215c7c3 --- /dev/null +++ b/src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php @@ -0,0 +1,16 @@ +; rel="service-doc"` header (RFC 8631) on pages that have a dedicated + * documentation page on docs.dotkernel.org, pointing at that page's own docs. + */ +class ServiceDocLinkMiddleware implements MiddlewareInterface +{ + private const array ROUTE_DOCS = [ + 'app::index' => 'https://docs.dotkernel.org/', + 'page::api' => 'https://docs.dotkernel.org/api-documentation/', + 'page::admin' => 'https://docs.dotkernel.org/admin-documentation/', + 'page::queue' => 'https://docs.dotkernel.org/queue-documentation/', + 'page::light' => 'https://docs.dotkernel.org/light-documentation/', + 'page::frontend' => 'https://docs.dotkernel.org/frontend/', + 'page::wsl2' => 'https://docs.dotkernel.org/development/v2/terminal/', + 'page::architecture' => 'https://docs.dotkernel.org/api-documentation/', + ]; + + public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface + { + $response = $handler->handle($request); + + $routeResult = $request->getAttribute(RouteResult::class); + if (! $routeResult instanceof RouteResult || ! $routeResult->isSuccess()) { + return $response; + } + + $routeName = $routeResult->getMatchedRouteName(); + if ($routeName === false || ! array_key_exists($routeName, self::ROUTE_DOCS)) { + return $response; + } + + $serviceDocLink = sprintf('<%s>; rel="service-doc"', self::ROUTE_DOCS[$routeName]); + $existingLink = $response->getHeaderLine('Link'); + + // A single `Link` header line with comma-separated values (RFC 8288 section 3), matching + // the style the `'*'` dot_response_headers entry already uses for llms-txt/llms-full-txt. + return $response->withHeader( + 'Link', + $existingLink === '' ? $serviceDocLink : $existingLink . ', ' . $serviceDocLink + ); + } +} diff --git a/test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php b/test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php new file mode 100644 index 00000000..a3316771 --- /dev/null +++ b/test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php @@ -0,0 +1,127 @@ +createMock(ResponseInterface::class); + $response->method('getHeaderLine')->with('Link')->willReturn(''); + $response + ->expects($this->once()) + ->method('withHeader') + ->with('Link', '; rel="service-doc"') + ->willReturn($response); + + $handler = $this->createStub(RequestHandlerInterface::class); + $handler->method('handle')->willReturn($response); + + $routeResult = $this->createStub(RouteResult::class); + $routeResult->method('isSuccess')->willReturn(true); + $routeResult->method('getMatchedRouteName')->willReturn('page::api'); + + $request = $this->createStub(ServerRequestInterface::class); + $request->method('getAttribute')->willReturn($routeResult); + + $middleware = new ServiceDocLinkMiddleware(); + $result = $middleware->process($request, $handler); + + $this->assertSame($response, $result); + } + + /** + * @throws Exception + */ + public function testCombinesWithAnExistingLinkHeaderIntoOneLine(): void + { + $response = $this->createMock(ResponseInterface::class); + $response->method('getHeaderLine')->with('Link')->willReturn( + '; rel="llms-txt", ; rel="llms-full-txt"' + ); + $response + ->expects($this->once()) + ->method('withHeader') + ->with( + 'Link', + '; rel="llms-txt", ; rel="llms-full-txt", ' + . '; rel="service-doc"' + ) + ->willReturn($response); + + $handler = $this->createStub(RequestHandlerInterface::class); + $handler->method('handle')->willReturn($response); + + $routeResult = $this->createStub(RouteResult::class); + $routeResult->method('isSuccess')->willReturn(true); + $routeResult->method('getMatchedRouteName')->willReturn('app::index'); + + $request = $this->createStub(ServerRequestInterface::class); + $request->method('getAttribute')->willReturn($routeResult); + + $middleware = new ServiceDocLinkMiddleware(); + $result = $middleware->process($request, $handler); + + $this->assertSame($response, $result); + } + + /** + * @throws Exception + */ + public function testLeavesResponseUntouchedForRouteWithNoDedicatedDocs(): void + { + $response = $this->createMock(ResponseInterface::class); + $response->expects($this->never())->method('withHeader'); + + $handler = $this->createStub(RequestHandlerInterface::class); + $handler->method('handle')->willReturn($response); + + $routeResult = $this->createStub(RouteResult::class); + $routeResult->method('isSuccess')->willReturn(true); + $routeResult->method('getMatchedRouteName')->willReturn('page::dotboost'); + + $request = $this->createStub(ServerRequestInterface::class); + $request->method('getAttribute')->willReturn($routeResult); + + $middleware = new ServiceDocLinkMiddleware(); + $result = $middleware->process($request, $handler); + + $this->assertSame($response, $result); + } + + /** + * @throws Exception + */ + public function testLeavesResponseUntouchedWhenRoutingFailed(): void + { + $response = $this->createMock(ResponseInterface::class); + $response->expects($this->never())->method('withHeader'); + + $handler = $this->createStub(RequestHandlerInterface::class); + $handler->method('handle')->willReturn($response); + + $routeResult = $this->createStub(RouteResult::class); + $routeResult->method('isSuccess')->willReturn(false); + + $request = $this->createStub(ServerRequestInterface::class); + $request->method('getAttribute')->willReturn($routeResult); + + $middleware = new ServiceDocLinkMiddleware(); + $result = $middleware->process($request, $handler); + + $this->assertSame($response, $result); + } +} From e12a26d9356bade05722e6d49b1cc4a38f4826a6 Mon Sep 17 00:00:00 2001 From: olaru Date: Thu, 10 Sep 2026 15:27:32 +0300 Subject: [PATCH 2/5] extend Link header --- config/autoload/local.php.dist | 31 ++++- config/pipeline.php | 2 - src/App/src/ConfigProvider.php | 3 - .../ServiceDocLinkMiddlewareFactory.php | 16 --- .../Middleware/ServiceDocLinkMiddleware.php | 57 -------- .../ServiceDocLinkMiddlewareTest.php | 127 ------------------ 6 files changed, 29 insertions(+), 207 deletions(-) delete mode 100644 src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php delete mode 100644 src/App/src/Middleware/ServiceDocLinkMiddleware.php delete mode 100644 test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 57fc88e0..b17b6159 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -46,11 +46,14 @@ $app = [ ], ]; +$llmsTxtLink = '; rel="llms-txt", ; rel="llms-full-txt"'; +$serviceDocLink = static fn (string $url): string => sprintf('<%s>; rel="service-doc", ', $url) . $llmsTxtLink; + return [ 'application' => $app, 'databases' => $databases, 'dot_response_headers' => [ - '*' => [ + '*' => [ 'X-Powered-By' => [ 'value' => $app['meta']['siteName'], 'overwrite' => true, @@ -60,10 +63,34 @@ return [ 'overwrite' => true, ], 'Link' => [ - 'value' => '; rel="llms-txt", ; rel="llms-full-txt"', + 'value' => $llmsTxtLink, 'overwrite' => true, ], ], + 'app::index' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/'), 'overwrite' => true], + ], + 'page::api' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), 'overwrite' => true], + ], + 'page::admin' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/admin-documentation/'), 'overwrite' => true], + ], + 'page::queue' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/queue-documentation/'), 'overwrite' => true], + ], + 'page::light' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/light-documentation/'), 'overwrite' => true], + ], + 'page::frontend' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/frontend/'), 'overwrite' => true], + ], + 'page::wsl2' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/development/v2/terminal/'), 'overwrite' => true], + ], + 'page::architecture' => [ + 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), 'overwrite' => true], + ], ], 'doctrine' => [ 'connection' => [ diff --git a/config/pipeline.php b/config/pipeline.php index 4aeb4236..6640698a 100644 --- a/config/pipeline.php +++ b/config/pipeline.php @@ -4,7 +4,6 @@ use Dot\ErrorHandler\ErrorHandlerInterface; use Dot\ResponseHeader\Middleware\ResponseHeaderMiddleware; -use Light\App\Middleware\ServiceDocLinkMiddleware; use Mezzio\Application; use Mezzio\Handler\NotFoundHandler; use Mezzio\Helper\ServerUrlMiddleware; @@ -52,7 +51,6 @@ $app->pipe(ImplicitHeadMiddleware::class); $app->pipe(ImplicitOptionsMiddleware::class); $app->pipe(MethodNotAllowedMiddleware::class); - $app->pipe(ServiceDocLinkMiddleware::class); $app->pipe(ResponseHeaderMiddleware::class); // Seed the UrlHelper with the routing results: diff --git a/src/App/src/ConfigProvider.php b/src/App/src/ConfigProvider.php index 59e0e741..965448c3 100644 --- a/src/App/src/ConfigProvider.php +++ b/src/App/src/ConfigProvider.php @@ -24,14 +24,12 @@ use Light\App\Factory\MarkdownExtensionFactory; use Light\App\Factory\MarkdownRuntimeLoaderFactory; use Light\App\Factory\PackageGeneratorFactory; -use Light\App\Factory\ServiceDocLinkMiddlewareFactory; use Light\App\Factory\SitemapGeneratorFactory; use Light\App\Handler\GetFeedViewHandler; use Light\App\Handler\GetIndexViewHandler; use Light\App\Handler\GetMarkdownArticleHandler; use Light\App\Handler\GetPackagesViewHandler; use Light\App\Handler\GetSitemapViewHandler; -use Light\App\Middleware\ServiceDocLinkMiddleware; use Light\App\Resolver\EntityListenerResolver; use Light\App\Service\FeedGenerator; use Light\App\Service\GitHubClient; @@ -152,7 +150,6 @@ public function getDependencies(): array LlmsGenerator::class => LlmsGeneratorFactory::class, MarkdownExtension::class => MarkdownExtensionFactory::class, RuntimeLoaderInterface::class => MarkdownRuntimeLoaderFactory::class, - ServiceDocLinkMiddleware::class => ServiceDocLinkMiddlewareFactory::class, ], 'aliases' => [ EntityManager::class => 'doctrine.entity_manager.orm_default', diff --git a/src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php b/src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php deleted file mode 100644 index 4215c7c3..00000000 --- a/src/App/src/Factory/ServiceDocLinkMiddlewareFactory.php +++ /dev/null @@ -1,16 +0,0 @@ -; rel="service-doc"` header (RFC 8631) on pages that have a dedicated - * documentation page on docs.dotkernel.org, pointing at that page's own docs. - */ -class ServiceDocLinkMiddleware implements MiddlewareInterface -{ - private const array ROUTE_DOCS = [ - 'app::index' => 'https://docs.dotkernel.org/', - 'page::api' => 'https://docs.dotkernel.org/api-documentation/', - 'page::admin' => 'https://docs.dotkernel.org/admin-documentation/', - 'page::queue' => 'https://docs.dotkernel.org/queue-documentation/', - 'page::light' => 'https://docs.dotkernel.org/light-documentation/', - 'page::frontend' => 'https://docs.dotkernel.org/frontend/', - 'page::wsl2' => 'https://docs.dotkernel.org/development/v2/terminal/', - 'page::architecture' => 'https://docs.dotkernel.org/api-documentation/', - ]; - - public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface - { - $response = $handler->handle($request); - - $routeResult = $request->getAttribute(RouteResult::class); - if (! $routeResult instanceof RouteResult || ! $routeResult->isSuccess()) { - return $response; - } - - $routeName = $routeResult->getMatchedRouteName(); - if ($routeName === false || ! array_key_exists($routeName, self::ROUTE_DOCS)) { - return $response; - } - - $serviceDocLink = sprintf('<%s>; rel="service-doc"', self::ROUTE_DOCS[$routeName]); - $existingLink = $response->getHeaderLine('Link'); - - // A single `Link` header line with comma-separated values (RFC 8288 section 3), matching - // the style the `'*'` dot_response_headers entry already uses for llms-txt/llms-full-txt. - return $response->withHeader( - 'Link', - $existingLink === '' ? $serviceDocLink : $existingLink . ', ' . $serviceDocLink - ); - } -} diff --git a/test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php b/test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php deleted file mode 100644 index a3316771..00000000 --- a/test/Unit/App/Middleware/ServiceDocLinkMiddlewareTest.php +++ /dev/null @@ -1,127 +0,0 @@ -createMock(ResponseInterface::class); - $response->method('getHeaderLine')->with('Link')->willReturn(''); - $response - ->expects($this->once()) - ->method('withHeader') - ->with('Link', '; rel="service-doc"') - ->willReturn($response); - - $handler = $this->createStub(RequestHandlerInterface::class); - $handler->method('handle')->willReturn($response); - - $routeResult = $this->createStub(RouteResult::class); - $routeResult->method('isSuccess')->willReturn(true); - $routeResult->method('getMatchedRouteName')->willReturn('page::api'); - - $request = $this->createStub(ServerRequestInterface::class); - $request->method('getAttribute')->willReturn($routeResult); - - $middleware = new ServiceDocLinkMiddleware(); - $result = $middleware->process($request, $handler); - - $this->assertSame($response, $result); - } - - /** - * @throws Exception - */ - public function testCombinesWithAnExistingLinkHeaderIntoOneLine(): void - { - $response = $this->createMock(ResponseInterface::class); - $response->method('getHeaderLine')->with('Link')->willReturn( - '; rel="llms-txt", ; rel="llms-full-txt"' - ); - $response - ->expects($this->once()) - ->method('withHeader') - ->with( - 'Link', - '; rel="llms-txt", ; rel="llms-full-txt", ' - . '; rel="service-doc"' - ) - ->willReturn($response); - - $handler = $this->createStub(RequestHandlerInterface::class); - $handler->method('handle')->willReturn($response); - - $routeResult = $this->createStub(RouteResult::class); - $routeResult->method('isSuccess')->willReturn(true); - $routeResult->method('getMatchedRouteName')->willReturn('app::index'); - - $request = $this->createStub(ServerRequestInterface::class); - $request->method('getAttribute')->willReturn($routeResult); - - $middleware = new ServiceDocLinkMiddleware(); - $result = $middleware->process($request, $handler); - - $this->assertSame($response, $result); - } - - /** - * @throws Exception - */ - public function testLeavesResponseUntouchedForRouteWithNoDedicatedDocs(): void - { - $response = $this->createMock(ResponseInterface::class); - $response->expects($this->never())->method('withHeader'); - - $handler = $this->createStub(RequestHandlerInterface::class); - $handler->method('handle')->willReturn($response); - - $routeResult = $this->createStub(RouteResult::class); - $routeResult->method('isSuccess')->willReturn(true); - $routeResult->method('getMatchedRouteName')->willReturn('page::dotboost'); - - $request = $this->createStub(ServerRequestInterface::class); - $request->method('getAttribute')->willReturn($routeResult); - - $middleware = new ServiceDocLinkMiddleware(); - $result = $middleware->process($request, $handler); - - $this->assertSame($response, $result); - } - - /** - * @throws Exception - */ - public function testLeavesResponseUntouchedWhenRoutingFailed(): void - { - $response = $this->createMock(ResponseInterface::class); - $response->expects($this->never())->method('withHeader'); - - $handler = $this->createStub(RequestHandlerInterface::class); - $handler->method('handle')->willReturn($response); - - $routeResult = $this->createStub(RouteResult::class); - $routeResult->method('isSuccess')->willReturn(false); - - $request = $this->createStub(ServerRequestInterface::class); - $request->method('getAttribute')->willReturn($routeResult); - - $middleware = new ServiceDocLinkMiddleware(); - $result = $middleware->process($request, $handler); - - $this->assertSame($response, $result); - } -} From e6af40f76c17457d9ffbeffe9bd0ae536fe13c07 Mon Sep 17 00:00:00 2001 From: olaru Date: Thu, 10 Sep 2026 15:35:44 +0300 Subject: [PATCH 3/5] cs fix --- config/autoload/local.php.dist | 40 +++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index b17b6159..95ce7920 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -68,28 +68,52 @@ return [ ], ], 'app::index' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/'), + 'overwrite' => true, + ], ], 'page::api' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), + 'overwrite' => true, + ], ], 'page::admin' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/admin-documentation/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/admin-documentation/'), + 'overwrite' => true, + ], ], 'page::queue' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/queue-documentation/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/queue-documentation/'), + 'overwrite' => true, + ], ], 'page::light' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/light-documentation/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/light-documentation/'), + 'overwrite' => true, + ], ], 'page::frontend' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/frontend/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/frontend/'), + 'overwrite' => true, + ], ], 'page::wsl2' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/development/v2/terminal/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/development/v2/terminal/'), + 'overwrite' => true, + ], ], 'page::architecture' => [ - 'Link' => ['value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), 'overwrite' => true], + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), + 'overwrite' => true, + ], ], ], 'doctrine' => [ From b6884beb07bb8ac96b28070b4152a17aadecae09 Mon Sep 17 00:00:00 2001 From: olaru Date: Mon, 14 Sep 2026 12:17:11 +0300 Subject: [PATCH 4/5] separate dot_response_headers configuration --- config/autoload/headers.global.php | 73 ++++++++++++++++++++++++++++++ config/autoload/local.php.dist | 67 --------------------------- 2 files changed, 73 insertions(+), 67 deletions(-) create mode 100644 config/autoload/headers.global.php diff --git a/config/autoload/headers.global.php b/config/autoload/headers.global.php new file mode 100644 index 00000000..2b3af221 --- /dev/null +++ b/config/autoload/headers.global.php @@ -0,0 +1,73 @@ +; rel="llms-txt", ; rel="llms-full-txt"'; +$serviceDocLink = static fn (string $url): string => sprintf('<%s>; rel="service-doc", ', $url) . $llmsTxtLink; + +return [ + 'dot_response_headers' => [ + '*' => [ + 'X-Powered-By' => [ + 'value' => 'Dotkernel', + 'overwrite' => true, + ], + 'X-Llms-Txt' => [ + 'value' => '/llms.txt', + 'overwrite' => true, + ], + 'Link' => [ + 'value' => $llmsTxtLink, + 'overwrite' => true, + ], + ], + 'app::index' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/'), + 'overwrite' => true, + ], + ], + 'page::api' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), + 'overwrite' => true, + ], + ], + 'page::admin' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/admin-documentation/'), + 'overwrite' => true, + ], + ], + 'page::queue' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/queue-documentation/'), + 'overwrite' => true, + ], + ], + 'page::light' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/light-documentation/'), + 'overwrite' => true, + ], + ], + 'page::frontend' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/frontend/'), + 'overwrite' => true, + ], + ], + 'page::wsl2' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/development/v2/terminal/'), + 'overwrite' => true, + ], + ], + 'page::architecture' => [ + 'Link' => [ + 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), + 'overwrite' => true, + ], + ], + ], +]; diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 95ce7920..0415ff3a 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -46,76 +46,9 @@ $app = [ ], ]; -$llmsTxtLink = '; rel="llms-txt", ; rel="llms-full-txt"'; -$serviceDocLink = static fn (string $url): string => sprintf('<%s>; rel="service-doc", ', $url) . $llmsTxtLink; - return [ 'application' => $app, 'databases' => $databases, - 'dot_response_headers' => [ - '*' => [ - 'X-Powered-By' => [ - 'value' => $app['meta']['siteName'], - 'overwrite' => true, - ], - 'X-Llms-Txt' => [ - 'value' => '/llms.txt', - 'overwrite' => true, - ], - 'Link' => [ - 'value' => $llmsTxtLink, - 'overwrite' => true, - ], - ], - 'app::index' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/'), - 'overwrite' => true, - ], - ], - 'page::api' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), - 'overwrite' => true, - ], - ], - 'page::admin' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/admin-documentation/'), - 'overwrite' => true, - ], - ], - 'page::queue' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/queue-documentation/'), - 'overwrite' => true, - ], - ], - 'page::light' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/light-documentation/'), - 'overwrite' => true, - ], - ], - 'page::frontend' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/frontend/'), - 'overwrite' => true, - ], - ], - 'page::wsl2' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/development/v2/terminal/'), - 'overwrite' => true, - ], - ], - 'page::architecture' => [ - 'Link' => [ - 'value' => $serviceDocLink('https://docs.dotkernel.org/api-documentation/'), - 'overwrite' => true, - ], - ], - ], 'doctrine' => [ 'connection' => [ 'orm_default' => [ From 620931fd0feb9435c8d59505cfab70b81b4585cb Mon Sep 17 00:00:00 2001 From: olaru Date: Mon, 14 Sep 2026 12:20:31 +0300 Subject: [PATCH 5/5] cs-fix --- config/autoload/headers.global.php | 2 +- config/autoload/local.php.dist | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/autoload/headers.global.php b/config/autoload/headers.global.php index 2b3af221..e56a1b2b 100644 --- a/config/autoload/headers.global.php +++ b/config/autoload/headers.global.php @@ -7,7 +7,7 @@ return [ 'dot_response_headers' => [ - '*' => [ + '*' => [ 'X-Powered-By' => [ 'value' => 'Dotkernel', 'overwrite' => true, diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 0415ff3a..3cd2b2e1 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -47,19 +47,19 @@ $app = [ ]; return [ - 'application' => $app, - 'databases' => $databases, - 'doctrine' => [ + 'application' => $app, + 'databases' => $databases, + 'doctrine' => [ 'connection' => [ 'orm_default' => [ 'params' => $databases['default'], ], ], ], - 'feed' => [ + 'feed' => [ 'path' => realpath(__DIR__ . '/../../public/feed.xml'), ], - 'llms' => [ + 'llms' => [ 'sourceDir' => realpath(__DIR__ . '/../../public/md-articles'), 'outputFile' => realpath(__DIR__ . '/../../public/llms-full.txt'), // Markdown versions of the static pages, appended after the articles. Optional.