@electriccitizen/bolt 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +93 -14
  2. package/dist/ai/agent.d.ts +66 -0
  3. package/dist/ai/agent.js +232 -0
  4. package/dist/ai/agent.js.map +1 -0
  5. package/dist/ai/knowledge/composer.md +90 -0
  6. package/dist/ai/knowledge/config-safety.md +46 -0
  7. package/dist/ai/knowledge/ddev-operations.md +41 -0
  8. package/dist/ai/knowledge/drupal-internals.md +52 -0
  9. package/dist/ai/knowledge/drupal-updates.md +90 -0
  10. package/dist/ai/knowledge/knowledge/composer.md +90 -0
  11. package/dist/ai/knowledge/knowledge/config-safety.md +46 -0
  12. package/dist/ai/knowledge/knowledge/ddev-operations.md +41 -0
  13. package/dist/ai/knowledge/knowledge/drupal-debugging.md +89 -0
  14. package/dist/ai/knowledge/knowledge/drupal-internals.md +52 -0
  15. package/dist/ai/knowledge/knowledge/drupal-updates.md +90 -0
  16. package/dist/ai/prompts/analyze-ticket.d.ts +30 -0
  17. package/dist/ai/prompts/analyze-ticket.js +116 -0
  18. package/dist/ai/prompts/analyze-ticket.js.map +1 -0
  19. package/dist/ai/prompts/fix-ticket.d.ts +27 -0
  20. package/dist/ai/prompts/fix-ticket.js +129 -0
  21. package/dist/ai/prompts/fix-ticket.js.map +1 -0
  22. package/dist/ai/prompts/pr-description.d.ts +19 -0
  23. package/dist/ai/prompts/pr-description.js +56 -0
  24. package/dist/ai/prompts/pr-description.js.map +1 -0
  25. package/dist/ai/prompts/update-package.d.ts +25 -0
  26. package/dist/ai/prompts/update-package.js +87 -0
  27. package/dist/ai/prompts/update-package.js.map +1 -0
  28. package/dist/ai/prompts/update-plan.d.ts +20 -0
  29. package/dist/ai/prompts/update-plan.js +66 -0
  30. package/dist/ai/prompts/update-plan.js.map +1 -0
  31. package/dist/ai/schemas/analysis-result.d.ts +44 -0
  32. package/dist/ai/schemas/analysis-result.js +101 -0
  33. package/dist/ai/schemas/analysis-result.js.map +1 -0
  34. package/dist/ai/schemas/fix-result.d.ts +34 -0
  35. package/dist/ai/schemas/fix-result.js +55 -0
  36. package/dist/ai/schemas/fix-result.js.map +1 -0
  37. package/dist/ai/schemas/pr-body.d.ts +12 -0
  38. package/dist/ai/schemas/pr-body.js +18 -0
  39. package/dist/ai/schemas/pr-body.js.map +1 -0
  40. package/dist/ai/schemas/update-plan.d.ts +20 -0
  41. package/dist/ai/schemas/update-plan.js +33 -0
  42. package/dist/ai/schemas/update-plan.js.map +1 -0
  43. package/dist/ai/schemas/update-result.d.ts +22 -0
  44. package/dist/ai/schemas/update-result.js +30 -0
  45. package/dist/ai/schemas/update-result.js.map +1 -0
  46. package/dist/cli.js +63 -1
  47. package/dist/cli.js.map +1 -1
  48. package/dist/commands/analyze.d.ts +25 -0
  49. package/dist/commands/analyze.js +377 -0
  50. package/dist/commands/analyze.js.map +1 -0
  51. package/dist/commands/doctor.js +61 -13
  52. package/dist/commands/doctor.js.map +1 -1
  53. package/dist/commands/fix.d.ts +35 -0
  54. package/dist/commands/fix.js +480 -0
  55. package/dist/commands/fix.js.map +1 -0
  56. package/dist/commands/init.d.ts +3 -2
  57. package/dist/commands/init.js +117 -160
  58. package/dist/commands/init.js.map +1 -1
  59. package/dist/commands/pr.d.ts +4 -0
  60. package/dist/commands/pr.js +121 -3
  61. package/dist/commands/pr.js.map +1 -1
  62. package/dist/commands/refresh.js +10 -57
  63. package/dist/commands/refresh.js.map +1 -1
  64. package/dist/commands/update.d.ts +2 -0
  65. package/dist/commands/update.js +463 -64
  66. package/dist/commands/update.js.map +1 -1
  67. package/dist/config.d.ts +16 -0
  68. package/dist/config.js +57 -0
  69. package/dist/config.js.map +1 -1
  70. package/dist/runner.js +12 -0
  71. package/dist/runner.js.map +1 -1
  72. package/dist/safety.d.ts +63 -0
  73. package/dist/safety.js +192 -0
  74. package/dist/safety.js.map +1 -0
  75. package/dist/types.d.ts +2 -0
  76. package/package.json +2 -3
  77. package/modules/bolt_inspect/bolt_inspect.info.yml +0 -6
  78. package/modules/bolt_inspect/bolt_inspect.services.yml +0 -22
  79. package/modules/bolt_inspect/composer.json +0 -16
  80. package/modules/bolt_inspect/drush.services.yml +0 -10
  81. package/modules/bolt_inspect/src/Drush/Commands/BoltInspectCommands.php +0 -203
  82. package/modules/bolt_inspect/src/Service/ContentGenerator.php +0 -586
  83. package/modules/bolt_inspect/src/Service/SiteProfiler.php +0 -362
  84. package/modules/bolt_inspect/src/Service/TestEntityTracker.php +0 -98
@@ -0,0 +1,52 @@
1
+ # Drupal Internals
2
+
3
+ Understanding common failure modes after module updates.
4
+
5
+ ## Why Updates Break Things
6
+
7
+ ### Hook system
8
+ - Modules implement hooks that fire during entity operations
9
+ - Updated modules may change hook implementations
10
+ - `auto_entitylabel` can null titles during entity hooks — set title before delete
11
+ - Search index hooks run during content operations — warnings are normal during cleanup
12
+
13
+ ### Entity lifecycle
14
+ - Content entities (nodes, media, terms) have create/update/delete hooks
15
+ - Entity reference fields create dependencies between entities
16
+ - Deleting referenced entities can fail if the reference field has constraints
17
+ - Paragraph entities must be deleted before their host entities
18
+
19
+ ### Caching
20
+ - Drupal aggressively caches render output, config, and routes
21
+ - After module updates, stale caches cause "white screen" or outdated behavior
22
+ - Always `drush cr` after any module update
23
+ - If `drush cr` doesn't fix it, try `drush cache:rebuild` (same thing, full form)
24
+ - Twig template cache is separate — cleared by `drush cr` but can be sticky
25
+
26
+ ### Configuration schema
27
+ - Modules define config schemas in `config/schema/*.yml`
28
+ - Schema changes in updated modules may require `drush updb` to migrate
29
+ - Missing schema warnings in logs are cosmetic but indicate potential issues
30
+
31
+ ## Common Post-Update Issues
32
+
33
+ | Symptom | Likely Cause | Fix |
34
+ |---------|-------------|-----|
35
+ | White screen / WSOD | PHP fatal from incompatible code | Check `ddev logs`, may need rollback |
36
+ | "Class not found" | Autoloader cache stale | `ddev composer dump-autoload && ddev drush cr` |
37
+ | "Schema not found" | Config schema changed | `ddev drush updb -y` |
38
+ | Missing permissions | New permissions added by module | Check `ddev drush role:list` |
39
+ | Broken views | Views plugins changed | `ddev drush views:rebuild` |
40
+ | Missing routes | Route definitions changed | `ddev drush cr` (rebuilds routing) |
41
+
42
+ ## Watchdog Interpretation
43
+
44
+ ```bash
45
+ ddev drush watchdog:show --count=20 --severity=Error
46
+ ```
47
+
48
+ - **PHP warnings/notices:** Usually cosmetic, don't block updates
49
+ - **Entity reference errors:** May indicate orphaned references
50
+ - **Access denied (403):** Permissions may have changed
51
+ - **Page not found (404):** Routes may have moved
52
+ - **Database errors:** Schema mismatch — need `drush updb`
@@ -0,0 +1,90 @@
1
+ # Drupal Update Safety
2
+
3
+ You are updating modules on a Drupal site. Follow these safety patterns.
4
+
5
+ ## Core Compatibility Checking
6
+
7
+ Before attempting a major version update, verify the target version is compatible with the current Drupal core.
8
+
9
+ ### How to check
10
+ ```bash
11
+ # Get current core version
12
+ ddev composer show drupal/core --format=json | jq -r '.versions[0]'
13
+
14
+ # Check all available versions of a module
15
+ ddev composer show --all drupal/<module> --format=json
16
+ ```
17
+
18
+ ### Constraint interpretation
19
+ - `^10.2` means `>=10.2.0 <11.0.0` — Drupal 10 only
20
+ - `^11` means `>=11.0.0 <12.0.0` — Drupal 11 only
21
+ - `^9.5 || ^10 || ^11` means any of those major versions
22
+ - `>=10.2` means 10.2.0 and above (including 11.x)
23
+
24
+ ### Decision logic
25
+ - If the target version requires a Drupal core version you don't have → find the highest compatible version instead
26
+ - If no compatible version exists above current → skip the update and report why
27
+ - If the module supports your core version → proceed with update
28
+
29
+ ## Update Categories
30
+
31
+ ### Security updates (auto-apply)
32
+ - Identified via `composer audit`
33
+ - Apply immediately without asking
34
+ - These fix known vulnerabilities
35
+
36
+ ### Patch updates (X.Y.Z → X.Y.Z+1)
37
+ - Backward compatible bug fixes
38
+ - Safe to apply automatically
39
+ - Rarely cause issues
40
+
41
+ ### Minor updates (X.Y → X.Y+1)
42
+ - New features, backward compatible
43
+ - May include deprecations
44
+ - Usually safe but test afterward
45
+
46
+ ### Major updates (X → X+1)
47
+ - May contain breaking changes
48
+ - Require compatibility checking
49
+ - May need config migration
50
+ - Test thoroughly after applying
51
+
52
+ ## Post-Update Verification
53
+
54
+ After every update:
55
+
56
+ 1. **Database updates:** `ddev drush updb -y`
57
+ - Read the output — note what hooks ran
58
+ - If it fails, the update may need manual intervention
59
+
60
+ 2. **Check for errors:** `ddev drush watchdog:show --count=10 --severity=Error`
61
+ - New errors after update indicate problems
62
+ - Compare to pre-update error count
63
+
64
+ 3. **Clear caches:** `ddev drush cr`
65
+ - Some updates require a cache rebuild to take effect
66
+
67
+ 4. **Export config:** `ddev drush cex -y`
68
+ - Some updates introduce new configuration
69
+ - Review what changed before committing
70
+
71
+ 5. **Run tests:** `bolt test --output=json`
72
+ - Verify no regressions
73
+ - If tests fail, the update introduced a problem
74
+
75
+ ## Common Drupal Update Patterns
76
+
77
+ - **Admin theme updates (gin):** Often require `gin_toolbar` to be updated together
78
+ - **Core updates:** Always update `drupal/core-recommended`, `drupal/core-composer-scaffold`, and `drupal/core-project-message` together
79
+ - **Paragraphs ecosystem:** `drupal/paragraphs`, `drupal/entity_reference_revisions` are tightly coupled
80
+ - **Media modules:** `drupal/media_library_form_element`, `drupal/focal_point`, `drupal/crop` may have interdependencies
81
+ - **CKEditor modules:** `drupal/ckeditor5_premium_features` depends on core CKEditor version
82
+
83
+ ## Rollback
84
+
85
+ If an update causes problems:
86
+ ```bash
87
+ git checkout .
88
+ git clean -fd
89
+ ```
90
+ This restores composer.json, composer.lock, and config to pre-update state.
@@ -0,0 +1,90 @@
1
+ # Composer Conflict Resolution
2
+
3
+ You are an expert at resolving Composer dependency conflicts for Drupal projects.
4
+
5
+ ## Diagnostic Workflow
6
+
7
+ When a `composer update` fails, follow this sequence:
8
+
9
+ 1. **Identify the blocker:** `composer why-not vendor/package <target-version>`
10
+ - Shows the dependency chain preventing the upgrade
11
+ - Read the output carefully — it tells you exactly which package constrains the version
12
+
13
+ 2. **Trace reverse dependencies:** `composer why vendor/package`
14
+ - Shows which installed packages depend on the blocked package
15
+ - Helps identify if updating a parent would unlock the target
16
+
17
+ 3. **Check available versions:** `composer show --all vendor/package`
18
+ - Lists all available versions
19
+ - Helps find the highest compatible version if the target isn't achievable
20
+
21
+ 4. **Apply the right update strategy** (see below)
22
+
23
+ 5. **Harden constraints after success:** `composer bump` (applications only, not libraries)
24
+ - Raises lower bounds to currently installed versions
25
+ - Prevents accidental downgrades
26
+
27
+ ## Update Strategies (in order of preference)
28
+
29
+ ### Strategy 1: Standard update with transitive deps
30
+ ```bash
31
+ composer update vendor/package --with-dependencies
32
+ ```
33
+ Tries first because it has the smallest blast radius.
34
+
35
+ ### Strategy 2: Update with all dependencies
36
+ ```bash
37
+ composer update vendor/package --with-all-dependencies
38
+ ```
39
+ Broader resolution — allows all transitive deps to change.
40
+
41
+ ### Strategy 3: Require with caret constraint
42
+ ```bash
43
+ composer require vendor/package:^X.Y --update-with-all-dependencies
44
+ ```
45
+ Rewrites the constraint in composer.json. Use when the existing constraint is too tight.
46
+
47
+ ### Strategy 4: Require with tilde constraint
48
+ ```bash
49
+ composer require vendor/package:~X.Y --update-with-all-dependencies
50
+ ```
51
+ More conservative — only allows patch updates within the minor version.
52
+
53
+ ### Strategy 5: Update alongside core
54
+ ```bash
55
+ composer update vendor/package drupal/core-recommended drupal/core-composer-scaffold drupal/core-project-message --with-all-dependencies
56
+ ```
57
+ Common Drupal pattern — many modules constrain against core version.
58
+
59
+ ### Strategy 6: Read the error and adapt
60
+ If all standard strategies fail, READ the actual error output:
61
+ - If it says "package X requires Y ^2.0 but Z is locked at 1.5" → update Z first
62
+ - If it says "root composer.json requires X ^1.0" → you may need to change the constraint
63
+ - If it says "package X conflicts with Y" → check if X has a newer version that resolves it
64
+ - Use `composer why-not` output to understand the exact constraint chain
65
+
66
+ ## Version Constraint Reference
67
+
68
+ | Constraint | Meaning |
69
+ |------------|---------|
70
+ | `^1.2.3` | `>=1.2.3 <2.0.0` (allows minor+patch) |
71
+ | `~1.2.3` | `>=1.2.3 <1.3.0` (allows patch only) |
72
+ | `>=1.0 <2.0` | Explicit range |
73
+ | `1.2.*` | Any 1.2.x patch |
74
+ | `*` | Any version |
75
+
76
+ ## Key Flags
77
+
78
+ - `--dry-run` — simulate without applying (always safe to run first)
79
+ - `--with-dependencies` — also update deps of specified packages
80
+ - `--with-all-dependencies` — also update deps AND reverse deps
81
+ - `--no-update` — modify composer.json without running update (combine with `composer update` separately)
82
+ - `--prefer-stable` — prefer stable over dev versions
83
+
84
+ ## Important Rules
85
+
86
+ - Always run `composer update` with package names specified — never bare `composer update` (too broad)
87
+ - After resolving a conflict, verify with `composer show vendor/package` that the installed version is correct
88
+ - If the target version requires a newer PHP, that's a hard blocker — skip the update
89
+ - If the target version requires a newer Drupal core, check if core can also be updated
90
+ - `composer audit` shows security advisories — security updates should be prioritized
@@ -0,0 +1,46 @@
1
+ # Configuration Management Safety
2
+
3
+ You are working with Drupal configuration. Follow these safety patterns.
4
+
5
+ ## Safe Config Export
6
+
7
+ After a module update, export config changes:
8
+ ```bash
9
+ ddev drush cex -y
10
+ ```
11
+
12
+ ### Review before committing
13
+ - Check `git diff config/` to see what actually changed
14
+ - Module updates may introduce new config files (new permissions, new field settings)
15
+ - Module updates may modify existing config (schema changes, new default values)
16
+ - Unexpected config changes may indicate a problem
17
+
18
+ ### What's normal after an update
19
+ - New config files for new module features
20
+ - Schema version changes in `.info.yml`
21
+ - Updated default values in existing config
22
+ - New permissions added by the module
23
+
24
+ ### What's suspicious after an update
25
+ - Config deletions you didn't expect
26
+ - Changes to content type or field config you didn't modify
27
+ - Changes to views or blocks unrelated to the updated module
28
+ - System config changes (site name, mail settings, etc.)
29
+
30
+ ## Config Status Check
31
+
32
+ ```bash
33
+ # Check if config is in sync
34
+ ddev drush config:status
35
+
36
+ # Show diff without importing
37
+ ddev drush cim --no --diff
38
+ ```
39
+
40
+ ## Important Rules
41
+
42
+ - NEVER run `ddev drush cim -y` during an update pipeline — only `cex`
43
+ - Config import (`cim`) is for syncing environments, not for updates
44
+ - Always export (`cex`) after `drush updb` — database updates may generate config changes
45
+ - If `config:status` shows unexpected changes, investigate before exporting
46
+ - One module update per commit keeps config changes traceable
@@ -0,0 +1,41 @@
1
+ # DDEV Operations
2
+
3
+ All commands run through DDEV. Use `ddev` prefix for all drush and composer commands.
4
+
5
+ ## Essential Commands
6
+
7
+ ```bash
8
+ ddev drush <command> # Run drush in container
9
+ ddev composer <command> # Run composer in container
10
+ ddev drush cr # Clear all caches
11
+ ddev drush updb -y # Apply database updates
12
+ ddev drush cex -y # Export configuration
13
+ ddev drush status # Check Drupal status
14
+ ddev drush watchdog:show # View recent log entries
15
+ ddev describe # Show project info + URL
16
+ ddev logs # View container logs
17
+ ddev snapshot --name=<name> # Create safety snapshot
18
+ ddev snapshot restore --name=<name> # Restore snapshot
19
+ ```
20
+
21
+ ## Safety Patterns
22
+
23
+ - **Snapshot before risky operations:** `ddev snapshot --name=pre-update-$(date +%Y%m%d-%H%M%S)`
24
+ - **Check DDEV is running:** `ddev describe` — if it fails, run `ddev start`
25
+ - **After composer changes:** always run `ddev drush cr` to clear caches
26
+ - **Diagnose problems:** `ddev logs -f` to follow container logs in real-time
27
+
28
+ ## Error Diagnosis
29
+
30
+ When something fails:
31
+ 1. Check drush watchdog: `ddev drush watchdog:show --count=20 --severity=Error`
32
+ 2. Check container logs: `ddev logs`
33
+ 3. Verify database connection: `ddev drush status`
34
+ 4. Try cache rebuild: `ddev drush cr`
35
+
36
+ ## Important Notes
37
+
38
+ - All file paths inside commands are container paths (e.g., `/var/www/html/web/`)
39
+ - Host paths and container paths are different — DDEV maps them automatically
40
+ - `composer install` syncs to lockfile (safe); `composer update` changes lockfile (update operation)
41
+ - DDEV auto-starts services but may need manual restart after config changes: `ddev restart`
@@ -0,0 +1,89 @@
1
+ # Drupal Debugging
2
+
3
+ Common failure patterns and debugging workflows for Drupal 11+ sites.
4
+
5
+ ## Bug Categories and Where to Look
6
+
7
+ ### Rendering / Display Issues
8
+ - **Blank page (WSOD):** Check `sites/default/files/php/twig/` for Twig errors, `drush ws --severity=error`, PHP error log
9
+ - **Wrong content shown:** Cache issue — `drush cr`, check `cache_render`, `cache_page` tables. Check Views cache settings.
10
+ - **Missing fields:** Field display mode config (`core.entity_view_display.*`), check field formatter settings
11
+ - **Broken layout:** Layout Builder config (`core.entity_view_display.*.*.default`), check block placement and visibility
12
+ - **Wrong template:** `drush twig:debug`, check template suggestions, theme override hierarchy
13
+
14
+ ### Form / Input Issues
15
+ - **Form validation errors:** Form alter hooks in custom modules, field widget settings, required field config
16
+ - **Submit does nothing:** JS error blocking form submit — check browser console. AJAX form handler may be broken.
17
+ - **Media upload fails:** Media library widget config, file system permissions (`sites/default/files/`), PHP upload limits
18
+ - **Field not saving:** Check field storage config vs field config, entity presave hooks, auto_entitylabel interference
19
+ - **WYSIWYG broken:** CKEditor 5 plugin config, text format settings (`filter.format.*`), allowed HTML tags
20
+
21
+ ### Access / Permissions Issues
22
+ - **403 on content:** Role permissions (`drush role:perm:list`), content access modules (node_access, content_moderation)
23
+ - **Menu item missing:** Menu link content access, menu block visibility, role permissions
24
+ - **Admin page 403:** Permission name change after module update — check `user.role.*` config
25
+
26
+ ### JS / Frontend Issues
27
+ - **JS error on page:** Drupal.behaviors not attaching — check `once()` calls, library dependencies in `*.libraries.yml`
28
+ - **AJAX broken:** Check `drupalSettings`, AJAX callback routes, session/CSRF token issues
29
+ - **Dialog/modal broken:** jQuery UI dialog deprecated in D11, check for contrib modules still using it
30
+ - **CSS not loading:** Aggregation cache stale (`drush cr`), library not attached, conditional library loading
31
+
32
+ ### Caching Issues
33
+ - **Changes not appearing:** `drush cr`, check cache tags, cache max-age on blocks/views, Varnish/CDN layer
34
+ - **Different content per user:** Cache context missing — add `user` or `user.roles` cache context
35
+ - **Stale after deploy:** `drush deploy:hook` not running, config import didn't trigger cache invalidation
36
+
37
+ ### Configuration Issues
38
+ - **Config mismatch:** `drush cst` (config status) — shows what's different between active and exported
39
+ - **Missing config on deploy:** Check `config_ignore` settings, confirm `drush cim` ran, check config split
40
+ - **Config import fails:** Schema version mismatch — run `drush updb` before `drush cim`
41
+
42
+ ### Module / Dependency Issues
43
+ - **Class not found:** Composer autoload stale — `ddev composer dump-autoload`
44
+ - **Service not found:** Module not enabled, service definition changed in update, container needs rebuild
45
+ - **Hook not firing:** Module weight/order, hook name changed in Drupal 11, check `module.module` vs event subscribers
46
+ - **Deprecated code warnings:** Drupal 11 removed many D9/D10 APIs — check deprecation docs, update to new APIs
47
+
48
+ ### Data / Content Issues
49
+ - **Missing content:** Content may exist but be unpublished — check `status` field, content moderation state
50
+ - **Entity reference broken:** Referenced entity deleted, target bundle changed, orphan references
51
+ - **Paragraphs issues:** Nested paragraph references, orphaned paragraph entities, revision table bloat
52
+ - **Search not finding content:** Search index stale — `drush sapi-rt && drush sapi-i`, check tracked/indexed counts
53
+
54
+ ## Debugging Commands
55
+
56
+ ```bash
57
+ # Error logs
58
+ ddev drush ws --severity=error --count=20
59
+
60
+ # Config inspection
61
+ ddev drush cget <config.name> # View specific config
62
+ ddev drush cst # Config status (active vs exported)
63
+ ddev drush config:diff <collection> # What changed
64
+
65
+ # Entity inspection
66
+ ddev drush entity:list # All entity types
67
+ ddev drush sql:query "SELECT type, count(*) FROM node_field_data GROUP BY type"
68
+
69
+ # Module info
70
+ ddev drush pm:list --status=enabled # Enabled modules
71
+ ddev drush pm:info <module> # Detailed module info
72
+ ddev drush eval "print_r(\Drupal::service('<service.id>'))"
73
+
74
+ # Cache
75
+ ddev drush cr # Rebuild cache
76
+ ddev drush cache:get <cid> <bin> # Inspect cache entry
77
+
78
+ # Permissions
79
+ ddev drush role:perm:list <role> # Role permissions
80
+ ddev drush user:info <uid> # User details
81
+ ```
82
+
83
+ ## Common Fix Patterns
84
+
85
+ - **Config fix:** Export correct config (`drush cex`), edit YAML, import (`drush cim`)
86
+ - **Permission fix:** `drush role:perm:add <role> '<permission>'`
87
+ - **Cache fix:** `drush cr` + verify cache tags and contexts
88
+ - **Code fix:** Custom module or theme code, then `drush cr` to pick up changes
89
+ - **Data fix:** Entity update via Drush eval or custom update hook
@@ -0,0 +1,52 @@
1
+ # Drupal Internals
2
+
3
+ Understanding common failure modes after module updates.
4
+
5
+ ## Why Updates Break Things
6
+
7
+ ### Hook system
8
+ - Modules implement hooks that fire during entity operations
9
+ - Updated modules may change hook implementations
10
+ - `auto_entitylabel` can null titles during entity hooks — set title before delete
11
+ - Search index hooks run during content operations — warnings are normal during cleanup
12
+
13
+ ### Entity lifecycle
14
+ - Content entities (nodes, media, terms) have create/update/delete hooks
15
+ - Entity reference fields create dependencies between entities
16
+ - Deleting referenced entities can fail if the reference field has constraints
17
+ - Paragraph entities must be deleted before their host entities
18
+
19
+ ### Caching
20
+ - Drupal aggressively caches render output, config, and routes
21
+ - After module updates, stale caches cause "white screen" or outdated behavior
22
+ - Always `drush cr` after any module update
23
+ - If `drush cr` doesn't fix it, try `drush cache:rebuild` (same thing, full form)
24
+ - Twig template cache is separate — cleared by `drush cr` but can be sticky
25
+
26
+ ### Configuration schema
27
+ - Modules define config schemas in `config/schema/*.yml`
28
+ - Schema changes in updated modules may require `drush updb` to migrate
29
+ - Missing schema warnings in logs are cosmetic but indicate potential issues
30
+
31
+ ## Common Post-Update Issues
32
+
33
+ | Symptom | Likely Cause | Fix |
34
+ |---------|-------------|-----|
35
+ | White screen / WSOD | PHP fatal from incompatible code | Check `ddev logs`, may need rollback |
36
+ | "Class not found" | Autoloader cache stale | `ddev composer dump-autoload && ddev drush cr` |
37
+ | "Schema not found" | Config schema changed | `ddev drush updb -y` |
38
+ | Missing permissions | New permissions added by module | Check `ddev drush role:list` |
39
+ | Broken views | Views plugins changed | `ddev drush views:rebuild` |
40
+ | Missing routes | Route definitions changed | `ddev drush cr` (rebuilds routing) |
41
+
42
+ ## Watchdog Interpretation
43
+
44
+ ```bash
45
+ ddev drush watchdog:show --count=20 --severity=Error
46
+ ```
47
+
48
+ - **PHP warnings/notices:** Usually cosmetic, don't block updates
49
+ - **Entity reference errors:** May indicate orphaned references
50
+ - **Access denied (403):** Permissions may have changed
51
+ - **Page not found (404):** Routes may have moved
52
+ - **Database errors:** Schema mismatch — need `drush updb`
@@ -0,0 +1,90 @@
1
+ # Drupal Update Safety
2
+
3
+ You are updating modules on a Drupal site. Follow these safety patterns.
4
+
5
+ ## Core Compatibility Checking
6
+
7
+ Before attempting a major version update, verify the target version is compatible with the current Drupal core.
8
+
9
+ ### How to check
10
+ ```bash
11
+ # Get current core version
12
+ ddev composer show drupal/core --format=json | jq -r '.versions[0]'
13
+
14
+ # Check all available versions of a module
15
+ ddev composer show --all drupal/<module> --format=json
16
+ ```
17
+
18
+ ### Constraint interpretation
19
+ - `^10.2` means `>=10.2.0 <11.0.0` — Drupal 10 only
20
+ - `^11` means `>=11.0.0 <12.0.0` — Drupal 11 only
21
+ - `^9.5 || ^10 || ^11` means any of those major versions
22
+ - `>=10.2` means 10.2.0 and above (including 11.x)
23
+
24
+ ### Decision logic
25
+ - If the target version requires a Drupal core version you don't have → find the highest compatible version instead
26
+ - If no compatible version exists above current → skip the update and report why
27
+ - If the module supports your core version → proceed with update
28
+
29
+ ## Update Categories
30
+
31
+ ### Security updates (auto-apply)
32
+ - Identified via `composer audit`
33
+ - Apply immediately without asking
34
+ - These fix known vulnerabilities
35
+
36
+ ### Patch updates (X.Y.Z → X.Y.Z+1)
37
+ - Backward compatible bug fixes
38
+ - Safe to apply automatically
39
+ - Rarely cause issues
40
+
41
+ ### Minor updates (X.Y → X.Y+1)
42
+ - New features, backward compatible
43
+ - May include deprecations
44
+ - Usually safe but test afterward
45
+
46
+ ### Major updates (X → X+1)
47
+ - May contain breaking changes
48
+ - Require compatibility checking
49
+ - May need config migration
50
+ - Test thoroughly after applying
51
+
52
+ ## Post-Update Verification
53
+
54
+ After every update:
55
+
56
+ 1. **Database updates:** `ddev drush updb -y`
57
+ - Read the output — note what hooks ran
58
+ - If it fails, the update may need manual intervention
59
+
60
+ 2. **Check for errors:** `ddev drush watchdog:show --count=10 --severity=Error`
61
+ - New errors after update indicate problems
62
+ - Compare to pre-update error count
63
+
64
+ 3. **Clear caches:** `ddev drush cr`
65
+ - Some updates require a cache rebuild to take effect
66
+
67
+ 4. **Export config:** `ddev drush cex -y`
68
+ - Some updates introduce new configuration
69
+ - Review what changed before committing
70
+
71
+ 5. **Run tests:** `bolt test --output=json`
72
+ - Verify no regressions
73
+ - If tests fail, the update introduced a problem
74
+
75
+ ## Common Drupal Update Patterns
76
+
77
+ - **Admin theme updates (gin):** Often require `gin_toolbar` to be updated together
78
+ - **Core updates:** Always update `drupal/core-recommended`, `drupal/core-composer-scaffold`, and `drupal/core-project-message` together
79
+ - **Paragraphs ecosystem:** `drupal/paragraphs`, `drupal/entity_reference_revisions` are tightly coupled
80
+ - **Media modules:** `drupal/media_library_form_element`, `drupal/focal_point`, `drupal/crop` may have interdependencies
81
+ - **CKEditor modules:** `drupal/ckeditor5_premium_features` depends on core CKEditor version
82
+
83
+ ## Rollback
84
+
85
+ If an update causes problems:
86
+ ```bash
87
+ git checkout .
88
+ git clean -fd
89
+ ```
90
+ This restores composer.json, composer.lock, and config to pre-update state.
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Prompt template for ticket analysis — examines a Jira ticket (or description)
3
+ * against the site profile and produces an investigation plan.
4
+ */
5
+ import type { AgentTask } from '../agent.js';
6
+ import type { SiteProfile } from '../../types.js';
7
+ export interface AnalyzeTicketContext {
8
+ /** Ticket key (e.g. PROJ-123) — empty if manual description. */
9
+ ticketKey: string;
10
+ /** Ticket summary/title. */
11
+ ticketSummary: string;
12
+ /** Full ticket description text. */
13
+ ticketDescription: string;
14
+ /** Ticket type (Bug, Task, Story, etc.). */
15
+ ticketType: string;
16
+ /** Ticket priority. */
17
+ ticketPriority: string;
18
+ /** Comments from the ticket (if available). */
19
+ ticketComments?: string[];
20
+ /** Site profile from bolt-inspect:profile. */
21
+ siteProfile: SiteProfile;
22
+ /** Recent git log (last ~20 commits). */
23
+ recentGitLog?: string;
24
+ /** Current bolt test results summary (if available). */
25
+ testResults?: string;
26
+ }
27
+ /**
28
+ * Build an AgentTask for analyzing a ticket.
29
+ */
30
+ export declare function buildAnalyzeTicketTask(ctx: AnalyzeTicketContext): AgentTask;