@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.
- package/README.md +93 -14
- package/dist/ai/agent.d.ts +66 -0
- package/dist/ai/agent.js +232 -0
- package/dist/ai/agent.js.map +1 -0
- package/dist/ai/knowledge/composer.md +90 -0
- package/dist/ai/knowledge/config-safety.md +46 -0
- package/dist/ai/knowledge/ddev-operations.md +41 -0
- package/dist/ai/knowledge/drupal-internals.md +52 -0
- package/dist/ai/knowledge/drupal-updates.md +90 -0
- package/dist/ai/knowledge/knowledge/composer.md +90 -0
- package/dist/ai/knowledge/knowledge/config-safety.md +46 -0
- package/dist/ai/knowledge/knowledge/ddev-operations.md +41 -0
- package/dist/ai/knowledge/knowledge/drupal-debugging.md +89 -0
- package/dist/ai/knowledge/knowledge/drupal-internals.md +52 -0
- package/dist/ai/knowledge/knowledge/drupal-updates.md +90 -0
- package/dist/ai/prompts/analyze-ticket.d.ts +30 -0
- package/dist/ai/prompts/analyze-ticket.js +116 -0
- package/dist/ai/prompts/analyze-ticket.js.map +1 -0
- package/dist/ai/prompts/fix-ticket.d.ts +27 -0
- package/dist/ai/prompts/fix-ticket.js +129 -0
- package/dist/ai/prompts/fix-ticket.js.map +1 -0
- package/dist/ai/prompts/pr-description.d.ts +19 -0
- package/dist/ai/prompts/pr-description.js +56 -0
- package/dist/ai/prompts/pr-description.js.map +1 -0
- package/dist/ai/prompts/update-package.d.ts +25 -0
- package/dist/ai/prompts/update-package.js +87 -0
- package/dist/ai/prompts/update-package.js.map +1 -0
- package/dist/ai/prompts/update-plan.d.ts +20 -0
- package/dist/ai/prompts/update-plan.js +66 -0
- package/dist/ai/prompts/update-plan.js.map +1 -0
- package/dist/ai/schemas/analysis-result.d.ts +44 -0
- package/dist/ai/schemas/analysis-result.js +101 -0
- package/dist/ai/schemas/analysis-result.js.map +1 -0
- package/dist/ai/schemas/fix-result.d.ts +34 -0
- package/dist/ai/schemas/fix-result.js +55 -0
- package/dist/ai/schemas/fix-result.js.map +1 -0
- package/dist/ai/schemas/pr-body.d.ts +12 -0
- package/dist/ai/schemas/pr-body.js +18 -0
- package/dist/ai/schemas/pr-body.js.map +1 -0
- package/dist/ai/schemas/update-plan.d.ts +20 -0
- package/dist/ai/schemas/update-plan.js +33 -0
- package/dist/ai/schemas/update-plan.js.map +1 -0
- package/dist/ai/schemas/update-result.d.ts +22 -0
- package/dist/ai/schemas/update-result.js +30 -0
- package/dist/ai/schemas/update-result.js.map +1 -0
- package/dist/cli.js +63 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/analyze.d.ts +25 -0
- package/dist/commands/analyze.js +377 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/doctor.js +61 -13
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/fix.d.ts +35 -0
- package/dist/commands/fix.js +480 -0
- package/dist/commands/fix.js.map +1 -0
- package/dist/commands/init.d.ts +3 -2
- package/dist/commands/init.js +117 -160
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/pr.d.ts +4 -0
- package/dist/commands/pr.js +121 -3
- package/dist/commands/pr.js.map +1 -1
- package/dist/commands/refresh.js +10 -57
- package/dist/commands/refresh.js.map +1 -1
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +463 -64
- package/dist/commands/update.js.map +1 -1
- package/dist/config.d.ts +16 -0
- package/dist/config.js +57 -0
- package/dist/config.js.map +1 -1
- package/dist/runner.js +12 -0
- package/dist/runner.js.map +1 -1
- package/dist/safety.d.ts +63 -0
- package/dist/safety.js +192 -0
- package/dist/safety.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/package.json +2 -3
- package/modules/bolt_inspect/bolt_inspect.info.yml +0 -6
- package/modules/bolt_inspect/bolt_inspect.services.yml +0 -22
- package/modules/bolt_inspect/composer.json +0 -16
- package/modules/bolt_inspect/drush.services.yml +0 -10
- package/modules/bolt_inspect/src/Drush/Commands/BoltInspectCommands.php +0 -203
- package/modules/bolt_inspect/src/Service/ContentGenerator.php +0 -586
- package/modules/bolt_inspect/src/Service/SiteProfiler.php +0 -362
- package/modules/bolt_inspect/src/Service/TestEntityTracker.php +0 -98
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
const OUTPUT_FORMAT = `{
|
|
6
|
+
"ticket": {
|
|
7
|
+
"key": "PROJ-123",
|
|
8
|
+
"summary": "Short ticket summary",
|
|
9
|
+
"type": "Bug",
|
|
10
|
+
"priority": "High"
|
|
11
|
+
},
|
|
12
|
+
"problemSummary": "Clear, concise description of what the ticket is actually asking — not just restating the title, but interpreting the real problem.",
|
|
13
|
+
"likelyCauses": [
|
|
14
|
+
{
|
|
15
|
+
"probability": "high | medium | low",
|
|
16
|
+
"description": "What could cause this problem and why this is likely",
|
|
17
|
+
"category": "config | code | permissions | js | caching | data | module"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"investigationSteps": [
|
|
21
|
+
{
|
|
22
|
+
"order": 1,
|
|
23
|
+
"description": "What to do and why",
|
|
24
|
+
"command": "ddev drush <specific command>",
|
|
25
|
+
"file": "path/to/relevant/file"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"suggestedTests": {
|
|
29
|
+
"plugins": ["browser-smoke", "field-interaction"],
|
|
30
|
+
"contentTypes": ["blog"],
|
|
31
|
+
"flags": ["--headed"]
|
|
32
|
+
},
|
|
33
|
+
"riskAssessment": "What else could be affected by this issue or its fix",
|
|
34
|
+
"relatedModules": ["drupal/media_library", "drupal/paragraphs"],
|
|
35
|
+
"confidence": {
|
|
36
|
+
"canFix": "autonomous | needs-info | needs-human",
|
|
37
|
+
"reason": "Why Claude can or cannot fix this without human intervention"
|
|
38
|
+
}
|
|
39
|
+
}`;
|
|
40
|
+
/**
|
|
41
|
+
* Build an AgentTask for analyzing a ticket.
|
|
42
|
+
*/
|
|
43
|
+
export function buildAnalyzeTicketTask(ctx) {
|
|
44
|
+
const goal = [
|
|
45
|
+
'You are Bolt\'s ticket analyst. Examine the provided ticket and site profile to produce a detailed investigation plan.',
|
|
46
|
+
'',
|
|
47
|
+
'## Your Job',
|
|
48
|
+
'- Understand what the ticket is really asking (not just restate the title)',
|
|
49
|
+
'- Cross-reference the problem against the site\'s actual structure (content types, fields, modules, routes)',
|
|
50
|
+
'- Identify the most likely root causes, ranked by probability',
|
|
51
|
+
'- Produce specific, actionable investigation steps (with actual drush commands and file paths)',
|
|
52
|
+
'- Assess whether this could be fixed autonomously by an AI agent, or needs human input',
|
|
53
|
+
'',
|
|
54
|
+
'## Rules',
|
|
55
|
+
'- Be specific to THIS site — use actual content types, field names, and module names from the profile',
|
|
56
|
+
'- Investigation steps must be concrete — actual commands to run, actual config names to check',
|
|
57
|
+
'- Don\'t guess — if the site profile doesn\'t have enough info, say what\'s missing',
|
|
58
|
+
'- Rank likely causes by probability, not just list them',
|
|
59
|
+
'- The "confidence" field is critical — be honest about what an AI can and cannot fix:',
|
|
60
|
+
' - "autonomous": The fix is likely a config change, permission tweak, CSS fix, or clear code change',
|
|
61
|
+
' - "needs-info": The analysis needs more data (screenshots, steps to reproduce, access to specific pages)',
|
|
62
|
+
' - "needs-human": The fix requires design decisions, stakeholder input, or complex refactoring',
|
|
63
|
+
'- All commands should use `ddev drush` or `ddev composer` prefix (DDEV environment)',
|
|
64
|
+
'- Do NOT run any commands — this is analysis only',
|
|
65
|
+
].join('\n');
|
|
66
|
+
// Build context with all available data.
|
|
67
|
+
const context = {
|
|
68
|
+
ticket: {
|
|
69
|
+
key: ctx.ticketKey || 'MANUAL',
|
|
70
|
+
summary: ctx.ticketSummary,
|
|
71
|
+
description: ctx.ticketDescription,
|
|
72
|
+
type: ctx.ticketType,
|
|
73
|
+
priority: ctx.ticketPriority,
|
|
74
|
+
},
|
|
75
|
+
siteProfile: {
|
|
76
|
+
contentTypes: ctx.siteProfile.contentTypes.map(ct => ({
|
|
77
|
+
id: ct.id,
|
|
78
|
+
label: ct.label,
|
|
79
|
+
fieldCount: ct.fields.length,
|
|
80
|
+
fields: ct.fields.map(f => `${f.name} (${f.type}, ${f.required ? 'required' : 'optional'})`),
|
|
81
|
+
})),
|
|
82
|
+
enabledModules: ctx.siteProfile.enabledModules,
|
|
83
|
+
routes: ctx.siteProfile.routes.slice(0, 50), // Limit to avoid prompt bloat.
|
|
84
|
+
mediaTypes: ctx.siteProfile.mediaTypes,
|
|
85
|
+
paragraphBundles: ctx.siteProfile.paragraphBundles.map(p => ({
|
|
86
|
+
id: p.id,
|
|
87
|
+
label: p.label,
|
|
88
|
+
fields: p.fields.map(f => `${f.name} (${f.type})`),
|
|
89
|
+
})),
|
|
90
|
+
menus: ctx.siteProfile.menus.map(m => ({
|
|
91
|
+
name: m.name,
|
|
92
|
+
itemCount: m.items.length,
|
|
93
|
+
})),
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
if (ctx.ticketComments && ctx.ticketComments.length > 0) {
|
|
97
|
+
context.ticketComments = ctx.ticketComments;
|
|
98
|
+
}
|
|
99
|
+
if (ctx.recentGitLog) {
|
|
100
|
+
context.recentGitLog = ctx.recentGitLog;
|
|
101
|
+
}
|
|
102
|
+
if (ctx.testResults) {
|
|
103
|
+
context.currentTestResults = ctx.testResults;
|
|
104
|
+
}
|
|
105
|
+
const knowledge = ['drupal-debugging', 'drupal-internals'];
|
|
106
|
+
return {
|
|
107
|
+
goal,
|
|
108
|
+
context,
|
|
109
|
+
knowledge,
|
|
110
|
+
outputFormat: OUTPUT_FORMAT,
|
|
111
|
+
maxTurns: 3, // Analysis is reasoning only — no tool use needed.
|
|
112
|
+
timeout: 60_000,
|
|
113
|
+
allowedTools: [], // No tools — pure reasoning.
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=analyze-ticket.js.map
|
|
@@ -0,0 +1 @@
|
|
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B,CAAC,kBAAqC,EAAE,kBAAkB,CAAC,CAAC;IAEjG,OAAO;QACL,IAAI;QACJ,OAAO;QACP,SAAS;QACT,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,CAAC,EAAE,mDAAmD;QAChE,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,EAAE,EAAE,6BAA6B;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for autonomous ticket fixing.
|
|
3
|
+
*
|
|
4
|
+
* Unlike analyze (pure reasoning), fix gives Claude full tool access
|
|
5
|
+
* to investigate, modify files, run drush commands, and verify.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentTask } from '../agent.js';
|
|
8
|
+
import type { SiteProfile } from '../../types.js';
|
|
9
|
+
import type { AnalysisResult } from '../schemas/analysis-result.js';
|
|
10
|
+
export interface FixTicketContext {
|
|
11
|
+
/** Analysis result from bolt analyze. */
|
|
12
|
+
analysis: AnalysisResult;
|
|
13
|
+
/** Site profile from bolt-inspect:profile. */
|
|
14
|
+
siteProfile: SiteProfile;
|
|
15
|
+
/** Additional context provided by the dev (answers to questions, etc.). */
|
|
16
|
+
additionalContext?: string;
|
|
17
|
+
/** The site URL (for reference in commands). */
|
|
18
|
+
siteUrl?: string;
|
|
19
|
+
/** Max turns for the fix agent. */
|
|
20
|
+
maxTurns?: number;
|
|
21
|
+
/** Timeout in ms. */
|
|
22
|
+
timeout?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build an AgentTask for fixing a ticket.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildFixTicketTask(ctx: FixTicketContext): AgentTask;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for autonomous ticket fixing.
|
|
3
|
+
*
|
|
4
|
+
* Unlike analyze (pure reasoning), fix gives Claude full tool access
|
|
5
|
+
* to investigate, modify files, run drush commands, and verify.
|
|
6
|
+
*/
|
|
7
|
+
const OUTPUT_FORMAT = `{
|
|
8
|
+
"ticket": {
|
|
9
|
+
"key": "PROJ-123",
|
|
10
|
+
"summary": "Short ticket summary"
|
|
11
|
+
},
|
|
12
|
+
"status": "fixed | partial | failed | needs-human",
|
|
13
|
+
"changes": [
|
|
14
|
+
{
|
|
15
|
+
"file": "path/to/changed/file",
|
|
16
|
+
"description": "What was changed and why",
|
|
17
|
+
"type": "modified | created | deleted"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"explanation": "Clear explanation of what was done, what the root cause was, and why this fix is correct.",
|
|
21
|
+
"followUp": ["Any manual steps still needed (optional)"]
|
|
22
|
+
}`;
|
|
23
|
+
/**
|
|
24
|
+
* Build an AgentTask for fixing a ticket.
|
|
25
|
+
*/
|
|
26
|
+
export function buildFixTicketTask(ctx) {
|
|
27
|
+
const { analysis } = ctx;
|
|
28
|
+
const goal = [
|
|
29
|
+
'You are Bolt\'s autonomous fixer. Your job is to resolve the described issue by modifying code, config, or templates.',
|
|
30
|
+
'',
|
|
31
|
+
'## Your Job',
|
|
32
|
+
'- Fix the issue described in the analysis below',
|
|
33
|
+
'- Use the investigation steps as a starting point, but adapt as you learn more',
|
|
34
|
+
'- Make the minimum changes needed to fix the problem',
|
|
35
|
+
'- Verify your fix works by checking the result (drush commands, file inspection)',
|
|
36
|
+
'- Explain clearly what you changed and why',
|
|
37
|
+
'',
|
|
38
|
+
'## Environment',
|
|
39
|
+
'- This is a Drupal 11+ site running in DDEV',
|
|
40
|
+
'- All drush commands: `ddev drush <command>`',
|
|
41
|
+
'- All composer commands: `ddev composer <command>`',
|
|
42
|
+
'- After config changes: `ddev drush cr` to rebuild cache',
|
|
43
|
+
'- After config edits: `ddev drush cex -y` to export changes',
|
|
44
|
+
'',
|
|
45
|
+
'## What You CAN Do',
|
|
46
|
+
'- Edit Drupal config YAML files (in config/sync/)',
|
|
47
|
+
'- Edit Twig templates (in themes/)',
|
|
48
|
+
'- Edit CSS/SCSS files',
|
|
49
|
+
'- Edit custom module code (.module, .theme, services, plugins)',
|
|
50
|
+
'- Run `ddev drush` commands (cr, cex, cim, cset, etc.)',
|
|
51
|
+
'- Run `ddev composer require/remove` for contrib modules',
|
|
52
|
+
'- Create or modify custom module code',
|
|
53
|
+
'',
|
|
54
|
+
'## What You MUST NOT Do',
|
|
55
|
+
'- Modify files in `core/` or `vendor/` — they\'re overwritten on next update',
|
|
56
|
+
'- Write direct SQL or modify production data/content',
|
|
57
|
+
'- Touch credentials, API keys, `.env` files, or secrets',
|
|
58
|
+
'- Modify deployment config (CI/CD, hosting, DNS)',
|
|
59
|
+
'- Modify or delete real user accounts or content',
|
|
60
|
+
'- Make changes that require a database migration on production',
|
|
61
|
+
'',
|
|
62
|
+
'## Rules',
|
|
63
|
+
'- Minimum viable fix — don\'t refactor unrelated code',
|
|
64
|
+
'- If you realize the fix is more complex than expected, set status to "partial" or "needs-human"',
|
|
65
|
+
'- Always clear cache (`ddev drush cr`) after config changes',
|
|
66
|
+
'- Always export config (`ddev drush cex -y`) after making changes via drush cset/cim',
|
|
67
|
+
'- If the fix involves Twig changes, check the template override hierarchy first',
|
|
68
|
+
'- If you can\'t fix it, set status to "failed" or "needs-human" with a clear explanation',
|
|
69
|
+
'',
|
|
70
|
+
'## Analysis',
|
|
71
|
+
'',
|
|
72
|
+
`### Problem`,
|
|
73
|
+
analysis.problemSummary,
|
|
74
|
+
'',
|
|
75
|
+
'### Likely Causes',
|
|
76
|
+
...analysis.likelyCauses.map(c => `- [${c.probability}] ${c.category}: ${c.description}`),
|
|
77
|
+
'',
|
|
78
|
+
'### Investigation Steps',
|
|
79
|
+
...analysis.investigationSteps.map(s => {
|
|
80
|
+
let line = `${s.order}. ${s.description}`;
|
|
81
|
+
if (s.command)
|
|
82
|
+
line += `\n $ ${s.command}`;
|
|
83
|
+
if (s.file)
|
|
84
|
+
line += `\n → ${s.file}`;
|
|
85
|
+
return line;
|
|
86
|
+
}),
|
|
87
|
+
'',
|
|
88
|
+
'### Risk Assessment',
|
|
89
|
+
analysis.riskAssessment || '(none provided)',
|
|
90
|
+
].join('\n');
|
|
91
|
+
const context = {
|
|
92
|
+
ticket: analysis.ticket,
|
|
93
|
+
siteProfile: {
|
|
94
|
+
contentTypes: ctx.siteProfile.contentTypes.map(ct => ({
|
|
95
|
+
id: ct.id,
|
|
96
|
+
label: ct.label,
|
|
97
|
+
fields: ct.fields.map(f => `${f.name} (${f.type}, ${f.required ? 'required' : 'optional'})`),
|
|
98
|
+
})),
|
|
99
|
+
enabledModules: ctx.siteProfile.enabledModules,
|
|
100
|
+
mediaTypes: ctx.siteProfile.mediaTypes,
|
|
101
|
+
paragraphBundles: ctx.siteProfile.paragraphBundles.map(p => ({
|
|
102
|
+
id: p.id,
|
|
103
|
+
label: p.label,
|
|
104
|
+
})),
|
|
105
|
+
},
|
|
106
|
+
relatedModules: analysis.relatedModules,
|
|
107
|
+
};
|
|
108
|
+
if (ctx.additionalContext) {
|
|
109
|
+
context.additionalContext = ctx.additionalContext;
|
|
110
|
+
}
|
|
111
|
+
if (ctx.siteUrl) {
|
|
112
|
+
context.siteUrl = ctx.siteUrl;
|
|
113
|
+
}
|
|
114
|
+
const knowledge = [
|
|
115
|
+
'drupal-debugging',
|
|
116
|
+
'drupal-internals',
|
|
117
|
+
'config-safety',
|
|
118
|
+
];
|
|
119
|
+
return {
|
|
120
|
+
goal,
|
|
121
|
+
context,
|
|
122
|
+
knowledge,
|
|
123
|
+
outputFormat: OUTPUT_FORMAT,
|
|
124
|
+
maxTurns: ctx.maxTurns ?? 50,
|
|
125
|
+
timeout: ctx.timeout ?? 600_000, // 10 minutes.
|
|
126
|
+
allowedTools: ['Bash', 'Read', 'Edit', 'Write', 'Glob', 'Grep'],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=fix-ticket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-ticket.js","sourceRoot":"","sources":["../../../src/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iB,CAAC;IACpD,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAChB,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAChC,CAAC;IAED,MAAM,SAAS,GAAsB;QACnC,kBAAqC;QACrC,kBAAkB;QAClB,eAAe;KAChB,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,OAAO;QACP,SAAS;QACT,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;QAC5B,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,OAAO,EAAE,cAAc;QAC/C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;KAChE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for writing PR descriptions from update results.
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentTask } from '../agent.js';
|
|
5
|
+
import type { UpdateResult } from '../../types.js';
|
|
6
|
+
export interface PrDescriptionContext {
|
|
7
|
+
/** The update result for this PR. */
|
|
8
|
+
result: UpdateResult;
|
|
9
|
+
/** Git diff stat for the branch. */
|
|
10
|
+
diffStat: string;
|
|
11
|
+
/** Commit message(s) on the branch. */
|
|
12
|
+
commitMessages: string;
|
|
13
|
+
/** Config files that changed. */
|
|
14
|
+
configChanges: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Build an AgentTask for writing a PR description.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildPrDescriptionTask(ctx: PrDescriptionContext): AgentTask;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for writing PR descriptions from update results.
|
|
3
|
+
*/
|
|
4
|
+
const OUTPUT_FORMAT = `{
|
|
5
|
+
"title": "Short PR title (under 70 chars)",
|
|
6
|
+
"body": "Full markdown PR body with summary, changes, test results, and config details"
|
|
7
|
+
}`;
|
|
8
|
+
/**
|
|
9
|
+
* Build an AgentTask for writing a PR description.
|
|
10
|
+
*/
|
|
11
|
+
export function buildPrDescriptionTask(ctx) {
|
|
12
|
+
const { result } = ctx;
|
|
13
|
+
const goal = [
|
|
14
|
+
'You are Bolt\'s PR writer. Write a clear, informative GitHub PR description for a Drupal module update.',
|
|
15
|
+
'',
|
|
16
|
+
'## PR Guidelines',
|
|
17
|
+
'- Title: concise, under 70 characters, e.g., "Update drupal/gin from 4.0.6 to 5.0.12"',
|
|
18
|
+
'- Body should include:',
|
|
19
|
+
' - Summary of what was updated and why (security fix? minor bump? major version?)',
|
|
20
|
+
' - Composer command used',
|
|
21
|
+
' - Database update status',
|
|
22
|
+
' - Config changes (list changed files if any, explain significance)',
|
|
23
|
+
' - Test results summary',
|
|
24
|
+
' - Any notable risks or things for the reviewer to check',
|
|
25
|
+
'- Use markdown formatting',
|
|
26
|
+
'- End with: `🤖 Generated by [Bolt](https://github.com/electriccitizen/bolt)`',
|
|
27
|
+
'',
|
|
28
|
+
'## Rules',
|
|
29
|
+
'- Be factual — only state what actually happened',
|
|
30
|
+
'- If config files changed, briefly explain what they likely contain',
|
|
31
|
+
'- If it was a major version update, note that breaking changes are possible',
|
|
32
|
+
'- Keep it concise — reviewers want signal, not noise',
|
|
33
|
+
'- Do NOT run any commands — just analyze the provided data',
|
|
34
|
+
].join('\n');
|
|
35
|
+
return {
|
|
36
|
+
goal,
|
|
37
|
+
context: {
|
|
38
|
+
package: result.package,
|
|
39
|
+
oldVersion: result.oldVersion,
|
|
40
|
+
newVersion: result.newVersion,
|
|
41
|
+
status: result.status,
|
|
42
|
+
testSummary: result.testSummary,
|
|
43
|
+
configChanges: ctx.configChanges,
|
|
44
|
+
dbUpdates: result.dbUpdates,
|
|
45
|
+
diffStat: ctx.diffStat,
|
|
46
|
+
commitMessages: ctx.commitMessages,
|
|
47
|
+
attempts: result.attempts,
|
|
48
|
+
},
|
|
49
|
+
knowledge: [],
|
|
50
|
+
outputFormat: OUTPUT_FORMAT,
|
|
51
|
+
maxTurns: 3, // PR writing is text generation — minimal turns.
|
|
52
|
+
timeout: 30_000,
|
|
53
|
+
allowedTools: [], // No tools needed.
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=pr-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-description.js","sourceRoot":"","sources":["../../../src/ai/prompts/pr-description.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,MAAM,aAAa,GAAG;;;EAGpB,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAyB;IAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEvB,MAAM,IAAI,GAAG;QACX,yGAAyG;QACzG,EAAE;QACF,kBAAkB;QAClB,uFAAuF;QACvF,wBAAwB;QACxB,oFAAoF;QACpF,2BAA2B;QAC3B,4BAA4B;QAC5B,sEAAsE;QACtE,0BAA0B;QAC1B,2DAA2D;QAC3D,2BAA2B;QAC3B,+EAA+E;QAC/E,EAAE;QACF,UAAU;QACV,kDAAkD;QAClD,qEAAqE;QACrE,6EAA6E;QAC7E,sDAAsD;QACtD,4DAA4D;KAC7D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO;QACL,IAAI;QACJ,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B;QACD,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,CAAC,EAAE,iDAAiD;QAC9D,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,EAAE,EAAE,mBAAmB;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for updating a single Drupal package.
|
|
3
|
+
* Claude handles the full lifecycle: composer update → conflict resolution →
|
|
4
|
+
* drush updb → watchdog check → config export.
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentTask } from '../agent.js';
|
|
7
|
+
import type { UpdateCandidate } from '../../types.js';
|
|
8
|
+
export interface UpdatePackageContext {
|
|
9
|
+
/** The package to update. */
|
|
10
|
+
candidate: UpdateCandidate;
|
|
11
|
+
/** Current Drupal core version. */
|
|
12
|
+
coreVersion: string;
|
|
13
|
+
/** Git branch name for this update. */
|
|
14
|
+
branchName: string;
|
|
15
|
+
/** Site URL for test commands. */
|
|
16
|
+
siteUrl: string;
|
|
17
|
+
/** Number of tests in the baseline. */
|
|
18
|
+
baselineTestCount: number;
|
|
19
|
+
/** Number of suppressed tests in the baseline. */
|
|
20
|
+
baselineSuppressedCount: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Build an AgentTask for updating a single package.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildUpdatePackageTask(ctx: UpdatePackageContext): AgentTask;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for updating a single Drupal package.
|
|
3
|
+
* Claude handles the full lifecycle: composer update → conflict resolution →
|
|
4
|
+
* drush updb → watchdog check → config export.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* JSON format the agent must return.
|
|
8
|
+
*/
|
|
9
|
+
const OUTPUT_FORMAT = `{
|
|
10
|
+
"success": true|false,
|
|
11
|
+
"package": "vendor/package",
|
|
12
|
+
"oldVersion": "1.0.0",
|
|
13
|
+
"newVersion": "1.1.0",
|
|
14
|
+
"strategy": "description of what worked or why it failed",
|
|
15
|
+
"composerCommand": "the composer command that succeeded",
|
|
16
|
+
"dbUpdatesApplied": true|false,
|
|
17
|
+
"dbUpdateOutput": "relevant drush updb output",
|
|
18
|
+
"watchdogErrors": ["any new errors found"],
|
|
19
|
+
"configChangesCount": 0,
|
|
20
|
+
"error": "error message if failed, null if succeeded"
|
|
21
|
+
}`;
|
|
22
|
+
/**
|
|
23
|
+
* Build an AgentTask for updating a single package.
|
|
24
|
+
*/
|
|
25
|
+
export function buildUpdatePackageTask(ctx) {
|
|
26
|
+
const { candidate, coreVersion, branchName, siteUrl } = ctx;
|
|
27
|
+
const goal = [
|
|
28
|
+
`You are Bolt's update agent. Update the Drupal package "${candidate.name}" ` +
|
|
29
|
+
`from version ${candidate.currentVersion} to ${candidate.latestVersion}.`,
|
|
30
|
+
'',
|
|
31
|
+
'## Environment',
|
|
32
|
+
`- DDEV local environment — all commands via \`ddev drush\` / \`ddev composer\``,
|
|
33
|
+
`- Drupal core version: ${coreVersion}`,
|
|
34
|
+
`- Git branch: ${branchName} (already created and checked out)`,
|
|
35
|
+
`- Site URL: ${siteUrl}`,
|
|
36
|
+
`- Baseline: ${ctx.baselineTestCount} tests passing, ${ctx.baselineSuppressedCount} suppressed`,
|
|
37
|
+
'',
|
|
38
|
+
'## Your task',
|
|
39
|
+
'',
|
|
40
|
+
`1. **Check compatibility:** Before updating, verify that ${candidate.latestVersion} ` +
|
|
41
|
+
`is compatible with Drupal core ${coreVersion}. If not, find the highest compatible version.`,
|
|
42
|
+
'',
|
|
43
|
+
`2. **Run composer update:** Start with \`ddev composer update ${candidate.name} --with-dependencies\`. ` +
|
|
44
|
+
`If it fails, read the error output, diagnose with \`ddev composer why-not\`, and try alternative strategies. ` +
|
|
45
|
+
`Keep trying until you find a working approach or determine it's truly impossible.`,
|
|
46
|
+
'',
|
|
47
|
+
`3. **Run database updates:** \`ddev drush updb -y\`. Read the output for errors.`,
|
|
48
|
+
'',
|
|
49
|
+
`4. **Check watchdog:** \`ddev drush watchdog:show --count=10 --severity=Error\`. ` +
|
|
50
|
+
`Note any new errors that appeared after the update.`,
|
|
51
|
+
'',
|
|
52
|
+
`5. **Export config:** \`ddev drush cex -y\`. This captures any config changes from the update.`,
|
|
53
|
+
'',
|
|
54
|
+
`6. **Clear caches:** \`ddev drush cr\`.`,
|
|
55
|
+
'',
|
|
56
|
+
'## Rules',
|
|
57
|
+
'- Do NOT run `bolt test` — the caller handles testing.',
|
|
58
|
+
'- Do NOT commit or stage files — the caller handles git.',
|
|
59
|
+
'- Do NOT modify any source code files — only composer and drush commands.',
|
|
60
|
+
'- If you cannot update the package after trying multiple strategies, report failure with details.',
|
|
61
|
+
`- If the best compatible version is lower than ${candidate.latestVersion}, update to that version instead.`,
|
|
62
|
+
'- Always clean up failed attempts: `git checkout . && git clean -fd` before trying a new strategy.',
|
|
63
|
+
].join('\n');
|
|
64
|
+
const knowledge = [
|
|
65
|
+
'composer',
|
|
66
|
+
'drupal-updates',
|
|
67
|
+
'config-safety',
|
|
68
|
+
'ddev-operations',
|
|
69
|
+
];
|
|
70
|
+
return {
|
|
71
|
+
goal,
|
|
72
|
+
context: {
|
|
73
|
+
package: candidate.name,
|
|
74
|
+
currentVersion: candidate.currentVersion,
|
|
75
|
+
targetVersion: candidate.latestVersion,
|
|
76
|
+
isSecurityUpdate: candidate.isSecurityUpdate,
|
|
77
|
+
coreVersion,
|
|
78
|
+
branchName,
|
|
79
|
+
},
|
|
80
|
+
knowledge,
|
|
81
|
+
outputFormat: OUTPUT_FORMAT,
|
|
82
|
+
maxTurns: 25,
|
|
83
|
+
timeout: 300_000,
|
|
84
|
+
allowedTools: ['Bash'],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=update-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-package.js","sourceRoot":"","sources":["../../../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CAAC,cAAc;YACxC,aAAa,EAAE,SAAS,CAAC,aAAa;YACtC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,WAAW;YACX,UAAU;SACX;QACD,SAAS;QACT,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,OAAO;QAChB,YAAY,EAAE,CAAC,MAAM,CAAC;KACvB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for planning update order and strategy.
|
|
3
|
+
* Claude evaluates all candidates and returns an ordered plan.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentTask } from '../agent.js';
|
|
6
|
+
import type { UpdateCandidate } from '../../types.js';
|
|
7
|
+
export interface UpdatePlanContext {
|
|
8
|
+
/** All update candidates. */
|
|
9
|
+
candidates: UpdateCandidate[];
|
|
10
|
+
/** Current Drupal core version. */
|
|
11
|
+
coreVersion: string;
|
|
12
|
+
/** Packages to ignore (from .bolt.yml). */
|
|
13
|
+
ignorePatterns: string[];
|
|
14
|
+
/** Priority packages (from .bolt.yml). */
|
|
15
|
+
priorityPackages: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build an AgentTask for planning updates.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildUpdatePlanTask(ctx: UpdatePlanContext): AgentTask;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template for planning update order and strategy.
|
|
3
|
+
* Claude evaluates all candidates and returns an ordered plan.
|
|
4
|
+
*/
|
|
5
|
+
const OUTPUT_FORMAT = `{
|
|
6
|
+
"plan": [
|
|
7
|
+
{
|
|
8
|
+
"package": "vendor/package",
|
|
9
|
+
"targetVersion": "1.1.0",
|
|
10
|
+
"strategy": "brief description of recommended approach",
|
|
11
|
+
"risk": "low|medium|high",
|
|
12
|
+
"reason": "why this order and strategy",
|
|
13
|
+
"skipReason": "if skipped, why (null if not skipped)"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"notes": "any overall observations about the update set"
|
|
17
|
+
}`;
|
|
18
|
+
/**
|
|
19
|
+
* Build an AgentTask for planning updates.
|
|
20
|
+
*/
|
|
21
|
+
export function buildUpdatePlanTask(ctx) {
|
|
22
|
+
const goal = [
|
|
23
|
+
'You are Bolt\'s planning agent. Analyze these outdated Drupal packages and create an optimal update plan.',
|
|
24
|
+
'',
|
|
25
|
+
'## Your Task',
|
|
26
|
+
'',
|
|
27
|
+
'Review each candidate and determine:',
|
|
28
|
+
'1. **Order:** Which packages should be updated first? (security first, then dependencies, then the rest)',
|
|
29
|
+
'2. **Strategy:** What composer approach is best for each? (standard update vs. require vs. update with core)',
|
|
30
|
+
'3. **Risk:** Is this a low/medium/high risk update? (patch=low, minor=medium, major=high)',
|
|
31
|
+
'4. **Skip:** Should any be skipped? (incompatible with current core, known conflicts, etc.)',
|
|
32
|
+
'',
|
|
33
|
+
'## Rules',
|
|
34
|
+
'- Security updates always come first',
|
|
35
|
+
'- If multiple packages are tightly coupled (e.g., gin + gin_toolbar), group them',
|
|
36
|
+
'- Check if major version updates are compatible with current Drupal core',
|
|
37
|
+
'- Packages in the priority list should come after security but before others',
|
|
38
|
+
'- Do NOT run any commands — this is analysis only. Use your knowledge to reason about the plan.',
|
|
39
|
+
'- Be concise in your reasoning',
|
|
40
|
+
].join('\n');
|
|
41
|
+
const knowledge = [
|
|
42
|
+
'composer',
|
|
43
|
+
'drupal-updates',
|
|
44
|
+
];
|
|
45
|
+
return {
|
|
46
|
+
goal,
|
|
47
|
+
context: {
|
|
48
|
+
candidates: ctx.candidates.map((c) => ({
|
|
49
|
+
name: c.name,
|
|
50
|
+
current: c.currentVersion,
|
|
51
|
+
latest: c.latestVersion,
|
|
52
|
+
updateType: c.updateType,
|
|
53
|
+
isSecurityUpdate: c.isSecurityUpdate,
|
|
54
|
+
})),
|
|
55
|
+
coreVersion: ctx.coreVersion,
|
|
56
|
+
ignorePatterns: ctx.ignorePatterns,
|
|
57
|
+
priorityPackages: ctx.priorityPackages,
|
|
58
|
+
},
|
|
59
|
+
knowledge,
|
|
60
|
+
outputFormat: OUTPUT_FORMAT,
|
|
61
|
+
maxTurns: 5, // Planning is analysis only — shouldn't need many turns.
|
|
62
|
+
timeout: 60_000,
|
|
63
|
+
allowedTools: [], // No tools needed for planning.
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=update-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-plan.js","sourceRoot":"","sources":["../../../src/ai/prompts/update-plan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,MAAM,aAAa,GAAG;;;;;;;;;;;;EAYpB,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAsB;IACxD,MAAM,IAAI,GAAG;QACX,2GAA2G;QAC3G,EAAE;QACF,cAAc;QACd,EAAE;QACF,sCAAsC;QACtC,0GAA0G;QAC1G,8GAA8G;QAC9G,2FAA2F;QAC3F,6FAA6F;QAC7F,EAAE;QACF,UAAU;QACV,sCAAsC;QACtC,kFAAkF;QAClF,0EAA0E;QAC1E,8EAA8E;QAC9E,iGAAiG;QACjG,gCAAgC;KACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAsB;QACnC,UAAU;QACV,gBAAgB;KACjB,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,OAAO,EAAE;YACP,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,OAAO,EAAE,CAAC,CAAC,cAAc;gBACzB,MAAM,EAAE,CAAC,CAAC,aAAa;gBACvB,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,gBAAgB,EAAE,CAAC,CAAC,gBAAgB;aACrC,CAAC,CAAC;YACH,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;SACvC;QACD,SAAS;QACT,YAAY,EAAE,aAAa;QAC3B,QAAQ,EAAE,CAAC,EAAE,yDAAyD;QACtE,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,EAAE,EAAE,gCAAgC;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema validation for AI-generated ticket analysis results.
|
|
3
|
+
*/
|
|
4
|
+
export interface TicketInfo {
|
|
5
|
+
key: string;
|
|
6
|
+
summary: string;
|
|
7
|
+
type: string;
|
|
8
|
+
priority: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LikelyCause {
|
|
11
|
+
probability: 'high' | 'medium' | 'low';
|
|
12
|
+
description: string;
|
|
13
|
+
category: 'config' | 'code' | 'permissions' | 'js' | 'caching' | 'data' | 'module';
|
|
14
|
+
}
|
|
15
|
+
export interface InvestigationStep {
|
|
16
|
+
order: number;
|
|
17
|
+
description: string;
|
|
18
|
+
command?: string;
|
|
19
|
+
file?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SuggestedTests {
|
|
22
|
+
plugins: string[];
|
|
23
|
+
contentTypes?: string[];
|
|
24
|
+
flags?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface AnalysisResult {
|
|
27
|
+
ticket: TicketInfo;
|
|
28
|
+
problemSummary: string;
|
|
29
|
+
likelyCauses: LikelyCause[];
|
|
30
|
+
investigationSteps: InvestigationStep[];
|
|
31
|
+
suggestedTests: SuggestedTests;
|
|
32
|
+
riskAssessment: string;
|
|
33
|
+
relatedModules: string[];
|
|
34
|
+
/** Confidence assessment for MVP-8 (bolt fix). */
|
|
35
|
+
confidence?: {
|
|
36
|
+
canFix: 'autonomous' | 'needs-info' | 'needs-human';
|
|
37
|
+
reason: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Validate and coerce agent output into AnalysisResult.
|
|
42
|
+
* Returns null if the output is missing required fields.
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateAnalysisResult(raw: Record<string, unknown>): AnalysisResult | null;
|