Skip to content

Commit 5c386fa

Browse files
committed
Added support for all AI agents + docs.
1 parent 92481f3 commit 5c386fa

31 files changed

Lines changed: 308 additions & 255 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
sidebar_label: AI
3+
sidebar_position: 7
4+
---
5+
6+
# AI
7+
8+
**Vortex** provides built-in support for AI coding agents. The integration is
9+
configured through structured markdown files that give agents the context they
10+
need to work effectively within the project.
11+
12+
## How it works
13+
14+
The AI integration follows the same two-tier documentation pattern used
15+
throughout **Vortex**:
16+
17+
- **What** applies to the project is defined in the `docs/` directory. The
18+
agent reads all files in `docs/` to understand project-specific decisions
19+
such as testing conventions, CI configuration, deployment rules, and
20+
release processes.
21+
- **How** to perform operations is sourced from the
22+
https://www.vortextemplate.com/docs (this site). The
23+
`AGENTS.md` file instructs agents to fetch operational guides from the
24+
website and cache them locally in `.data/ai-artifacts/`.
25+
26+
This means AI agents receive the same layered guidance as human developers:
27+
project-level decisions first, then Vortex-level procedures.
28+
29+
## Configuration files
30+
31+
### `AGENTS.md`
32+
33+
The [`AGENTS.md`](https://github.com/drevops/vortex/blob/main/AGENTS.md) file
34+
in the project root is the primary configuration for AI coding agents. It is
35+
an agent-agnostic file that any AI tool can use.
36+
37+
Key sections include:
38+
39+
- **Daily development tasks** — a reference of `ahoy` commands for building,
40+
testing, and managing the local environment.
41+
- **Critical rules** — constraints that agents must always follow (e.g., never
42+
modify `scripts/vortex/`, always export config after admin UI changes).
43+
- **Key directories** — the project's directory layout.
44+
- **Documentation** — instructions for agents to check `docs/` files for
45+
project-specific decisions and to fetch operational documentation from
46+
https://www.vortextemplate.com/docs. Fetched documentation is cached locally so
47+
that agents can reuse it across sessions without repeated requests.
48+
49+
### `CLAUDE.md`
50+
51+
The [`CLAUDE.md`](https://github.com/drevops/vortex/blob/main/CLAUDE.md) file
52+
is automatically loaded by Claude Code at the start of every session. It
53+
references `AGENTS.md` for the full development guide.

.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,29 @@
44

55
namespace DrevOps\VortexInstaller\Prompts\Handlers;
66

7-
class AiCodeInstructions extends AbstractHandler {
8-
9-
const NONE = 'none';
7+
use DrevOps\VortexInstaller\Utils\File;
108

11-
const CLAUDE = 'claude';
9+
class AiCodeInstructions extends AbstractHandler {
1210

1311
/**
1412
* {@inheritdoc}
1513
*/
1614
public function label(): string {
17-
return 'AI code assistant instructions';
15+
return 'Provide AI agent instructions?';
1816
}
1917

2018
/**
2119
* {@inheritdoc}
2220
*/
2321
public function hint(array $responses): ?string {
24-
return 'Provides AI coding assistants with better context about the project.';
25-
}
26-
27-
/**
28-
* {@inheritdoc}
29-
*/
30-
public function options(array $responses): ?array {
31-
return [
32-
self::CLAUDE => 'Anthropic Claude',
33-
self::NONE => 'None',
34-
];
22+
return 'Provides AI coding agents with better context about the project.';
3523
}
3624

3725
/**
3826
* {@inheritdoc}
3927
*/
4028
public function default(array $responses): null|string|bool|array {
41-
return self::CLAUDE;
29+
return TRUE;
4230
}
4331

4432
/**
@@ -49,21 +37,18 @@ public function discover(): null|string|bool|array {
4937
return NULL;
5038
}
5139

52-
if (is_readable($this->dstDir . '/CLAUDE.md')) {
53-
return self::CLAUDE;
54-
}
55-
56-
return self::NONE;
40+
return File::exists($this->dstDir . '/AGENTS.md') || File::exists($this->dstDir . '/CLAUDE.md');
5741
}
5842

5943
/**
6044
* {@inheritdoc}
6145
*/
6246
public function process(): void {
63-
$v = $this->getResponseAsString();
47+
$v = $this->getResponseAsBool();
6448
$t = $this->tmpDir;
6549

66-
if ($v !== self::CLAUDE) {
50+
if (!$v) {
51+
@unlink($t . '/AGENTS.md');
6752
@unlink($t . '/CLAUDE.md');
6853
}
6954
}

.vortex/installer/src/Prompts/Handlers/Tools.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
286286
],
287287
'strings' => ['/^.*phpunit.*\n?/m'],
288288
'lines' => [
289-
'CLAUDE.md' => [
289+
'AGENTS.md' => [
290290
'# PHPUnit testing',
291291
'ahoy test # Run PHPUnit tests',
292292
'ahoy test-unit',
@@ -334,7 +334,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
334334
'/^.*\bgherkinlint\b.*\n?/m',
335335
],
336336
'lines' => [
337-
'CLAUDE.md' => [
337+
'AGENTS.md' => [
338338
'# Behat testing',
339339
'ahoy test-bdd',
340340
],

.vortex/installer/src/Prompts/PromptManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function runPrompts(): void {
205205
->add(fn($r, $pr, $n): bool => confirm(...$this->args(PreserveDocsProject::class)), PreserveDocsProject::id())
206206

207207
->intro('AI')
208-
->add(fn($r, $pr, $n): int|string => select(...$this->args(AiCodeInstructions::class)), AiCodeInstructions::id());
208+
->add(fn($r, $pr, $n): bool => confirm(...$this->args(AiCodeInstructions::class)), AiCodeInstructions::id());
209209

210210
// @formatter:on
211211
// phpcs:enable Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma
@@ -468,7 +468,7 @@ public function getResponsesSummary(): array {
468468
$values['Preserve project documentation'] = Converter::bool($responses[PreserveDocsProject::id()]);
469469

470470
$values['AI'] = Tui::LIST_SECTION_TITLE;
471-
$values['AI code assistant instructions'] = $responses[AiCodeInstructions::id()];
471+
$values['AI agent instructions'] = Converter::bool($responses[AiCodeInstructions::id()]);
472472

473473
$values['Locations'] = Tui::LIST_SECTION_TITLE;
474474
$values['Current directory'] = $this->config->getRoot();
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# star wars - Development Guide
2+
3+
## Daily Development Tasks
4+
5+
```bash
6+
# Environment
7+
ahoy up # Start containers
8+
ahoy down # Stop containers
9+
ahoy info # Show URLs and status
10+
ahoy login # Get admin login URL
11+
12+
# Build & Database
13+
ahoy download-db # Download fresh database from remote
14+
ahoy build # Complete site rebuild
15+
ahoy provision # Re-provision (import DB + apply config)
16+
ahoy import-db # Import database from file without applying config
17+
ahoy export-db # Export current local database
18+
19+
# Drush commands
20+
ahoy drush cr # Clear cache
21+
ahoy drush updb # Run database updates
22+
ahoy drush cex # Export configuration to code
23+
ahoy drush cim # Import configuration from code
24+
ahoy drush uli # Get one-time login link
25+
ahoy drush status # Check site status
26+
27+
# Composer
28+
ahoy composer install
29+
ahoy composer require drupal/[module_name]
30+
31+
# Code quality
32+
ahoy lint # Check code style
33+
ahoy lint-fix # Auto-fix code style
34+
35+
# PHPUnit testing
36+
ahoy test # Run PHPUnit tests
37+
ahoy test-unit # Run PHPUnit Unit tests
38+
ahoy test-kernel # Run PHPUnit Kernel tests
39+
ahoy test-functional # Run PHPUnit Functional tests
40+
ahoy test -- --filter=TestClassName # Run specific PHPUnit test class
41+
42+
# Behat testing
43+
ahoy test-bdd # Run Behat tests
44+
ahoy test-bdd -- --tags=@tagname # Run Behat tests with specific tag
45+
```
46+
47+
## Critical Rules
48+
49+
- **Never modify** `scripts/vortex/` - use `scripts/custom/` for your scripts
50+
- **Never use** `ahoy drush php:eval` - use `ahoy drush php:script` instead
51+
- **Always export config** after admin UI changes: `ahoy drush cex`
52+
53+
## Key Directories
54+
55+
- `web/modules/custom/` - Custom modules
56+
- `web/themes/custom/` - Custom themes
57+
- `config/default/` - Drupal configuration
58+
- `scripts/custom/` - Project scripts
59+
- `patches/` - Module patches
60+
61+
## Documentation
62+
63+
This project uses two documentation sources:
64+
65+
### Project-specific documentation (`docs/`)
66+
67+
The `docs/` directory contains **what** applies to this project:
68+
69+
- `docs/testing.md` - Testing conventions and agreements
70+
- `docs/ci.md` - CI provider and configuration
71+
- `docs/deployment.md` - Hosting provider and deployment rules
72+
- `docs/releasing.md` - Version scheme and release process
73+
- `docs/faqs.md` - Project-specific FAQs
74+
75+
**Always check these files first** to understand project-specific decisions.
76+
77+
### Vortex documentation (vortextemplate.com)
78+
79+
For **how** to perform operations, fetch from https://www.vortextemplate.com/docs.
80+
81+
Use the sitemap to discover available pages: https://www.vortextemplate.com/sitemap.xml
82+
83+
**Caching:** Save fetched docs to `.data/ai-artifacts/docs-[topic].md` with header
84+
`<!-- Source: [URL] | Cached: [YYYY-MM-DD] -->`.
85+
Re-fetch if user reports docs are outdated.
Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,3 @@
1-
# star wars - Development Guide
1+
# AI Agent Configuration
22

3-
<!-- CLAUDE_CONTEXT
4-
Drupal project built with Vortex template. Uses Docker locally, ahoy commands.
5-
For detailed guides, fetch from https://www.vortextemplate.com and cache in .claude/artifacts/.
6-
-->
7-
8-
## Daily Development Tasks
9-
10-
```bash
11-
# Environment
12-
ahoy up # Start containers
13-
ahoy down # Stop containers
14-
ahoy info # Show URLs and status
15-
ahoy login # Get admin login URL
16-
17-
# Build & Database
18-
ahoy download-db # Download fresh database from remote
19-
ahoy build # Complete site rebuild
20-
ahoy provision # Re-provision (import DB + apply config)
21-
ahoy import-db # Import database from file without applying config
22-
ahoy export-db # Export current local database
23-
24-
# Drush commands
25-
ahoy drush cr # Clear cache
26-
ahoy drush updb # Run database updates
27-
ahoy drush cex # Export configuration to code
28-
ahoy drush cim # Import configuration from code
29-
ahoy drush uli # Get one-time login link
30-
ahoy drush status # Check site status
31-
32-
# Composer
33-
ahoy composer install
34-
ahoy composer require drupal/[module_name]
35-
36-
# Code quality
37-
ahoy lint # Check code style
38-
ahoy lint-fix # Auto-fix code style
39-
40-
# PHPUnit testing
41-
ahoy test # Run PHPUnit tests
42-
ahoy test-unit # Run PHPUnit Unit tests
43-
ahoy test-kernel # Run PHPUnit Kernel tests
44-
ahoy test-functional # Run PHPUnit Functional tests
45-
ahoy test -- --filter=TestClassName # Run specific PHPUnit test class
46-
47-
# Behat testing
48-
ahoy test-bdd # Run Behat tests
49-
ahoy test-bdd -- --tags=@tagname # Run Behat tests with specific tag
50-
```
51-
52-
## Critical Rules
53-
54-
- **Never modify** `scripts/vortex/` - use `scripts/custom/` for your scripts
55-
- **Never use** `ahoy drush php:eval` - use `ahoy drush php:script` instead
56-
- **Always export config** after admin UI changes: `ahoy drush cex`
57-
58-
## Key Directories
59-
60-
- `web/modules/custom/` - Custom modules
61-
- `web/themes/custom/` - Custom themes
62-
- `config/default/` - Drupal configuration
63-
- `scripts/custom/` - Project scripts
64-
- `patches/` - Module patches
65-
66-
## Documentation
67-
68-
This project uses two documentation sources:
69-
70-
### Project-specific documentation (`docs/`)
71-
72-
The `docs/` directory contains **what** applies to this project:
73-
74-
- `docs/testing.md` - Testing conventions and agreements
75-
- `docs/ci.md` - CI provider and configuration
76-
- `docs/deployment.md` - Hosting provider and deployment rules
77-
- `docs/releasing.md` - Version scheme and release process
78-
- `docs/faqs.md` - Project-specific FAQs
79-
80-
**Always check these files first** to understand project-specific decisions.
81-
82-
### Vortex documentation (vortextemplate.com)
83-
84-
For **how** to perform operations, fetch from https://www.vortextemplate.com.
85-
86-
Use the sitemap to discover available pages:
87-
https://www.vortextemplate.com/sitemap.xml
88-
89-
**Caching:** Save fetched docs to `.claude/artifacts/docs-[topic].md` with header
90-
`<!-- Source: [URL] | Cached: [YYYY-MM-DD] -->`.
91-
Re-fetch if user reports docs are outdated.
3+
@AGENTS.md

.vortex/installer/tests/Fixtures/handler_process/ai_instructions_none/-CLAUDE.md renamed to .vortex/installer/tests/Fixtures/handler_process/ai_instructions_disabled/-AGENTS.md

File renamed without changes.

.vortex/installer/tests/Fixtures/handler_process/ai_instructions_disabled/-CLAUDE.md

Whitespace-only changes.

.vortex/installer/tests/Fixtures/handler_process/ai_instructions_none/.ignorecontent renamed to .vortex/installer/tests/Fixtures/handler_process/ai_instructions_disabled/.ignorecontent

File renamed without changes.

.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/CLAUDE.md renamed to .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@@ -57,8 +57,8 @@
1+
@@ -52,8 +52,8 @@
22

33
## Key Directories
44

0 commit comments

Comments
 (0)