edsger 0.58.0 → 0.60.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/dist/api/cross-product.js +0 -1
- package/dist/api/issues/issue-utils.js +0 -1
- package/dist/api/issues/update-issue.js +1 -1
- package/dist/commands/agent-workflow/chat-worker.js +1 -1
- package/dist/commands/checklists/index.js +1 -1
- package/dist/commands/product-techniques/index.d.ts +15 -0
- package/dist/commands/product-techniques/index.js +37 -0
- package/dist/commands/recipes/index.d.ts +15 -0
- package/dist/commands/recipes/index.js +34 -0
- package/dist/commands/workflow/executors/phase-executor.js +1 -1
- package/dist/index.js +24 -1
- package/dist/phases/analyze-logs/index.js +1 -1
- package/dist/phases/bug-fixing/context-fetcher.js +4 -2
- package/dist/phases/find-features/index.js +1 -1
- package/dist/phases/product-techniques/index.d.ts +52 -0
- package/dist/phases/product-techniques/index.js +268 -0
- package/dist/phases/product-techniques/mcp-server.d.ts +41 -0
- package/dist/phases/product-techniques/mcp-server.js +96 -0
- package/dist/phases/product-techniques/prompts.d.ts +19 -0
- package/dist/phases/product-techniques/prompts.js +66 -0
- package/dist/phases/product-techniques/types.d.ts +13 -0
- package/dist/phases/product-techniques/types.js +13 -0
- package/dist/phases/recipes/index.d.ts +56 -0
- package/dist/phases/recipes/index.js +301 -0
- package/dist/phases/recipes/mcp-server.d.ts +63 -0
- package/dist/phases/recipes/mcp-server.js +204 -0
- package/dist/phases/recipes/prompts.d.ts +35 -0
- package/dist/phases/recipes/prompts.js +105 -0
- package/dist/phases/recipes/types.d.ts +42 -0
- package/dist/phases/recipes/types.js +16 -0
- package/dist/phases/screen-flow/mcp-server.d.ts +1 -1
- package/dist/services/branches.js +3 -3
- package/dist/services/phase-hooks/hook-executor.js +1 -1
- package/dist/services/phase-ratings.js +1 -1
- package/dist/services/product-logs.js +1 -1
- package/dist/services/pull-requests.js +3 -3
- package/package.json +1 -1
- package/vitest.config.ts +1 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process MCP server exposing the recipes toolkit. Five tools:
|
|
3
|
+
*
|
|
4
|
+
* - get_recipe_detail read-only: fetch full content of a team recipe
|
|
5
|
+
* - create_recipe INSERT recipe + INSERT product_recipe link
|
|
6
|
+
* - update_recipe UPDATE recipe (latest-wins overwrite) + UPSERT link
|
|
7
|
+
* - link_recipe UPSERT product_recipe link only (no content change)
|
|
8
|
+
* - unlink_recipe DELETE product_recipe link for a previously-linked
|
|
9
|
+
* recipe the agent confirmed is no longer present
|
|
10
|
+
*
|
|
11
|
+
* All writes are scoped to:
|
|
12
|
+
* - the active recipe_scan's product_id (the link target)
|
|
13
|
+
* - the team that owns that product (recipes are team-scoped)
|
|
14
|
+
*
|
|
15
|
+
* The handlers persist directly via the Supabase client passed in by the
|
|
16
|
+
* orchestrator — there is no captured-extraction buffer to flush at the
|
|
17
|
+
* end. Each tool call is its own committed effect.
|
|
18
|
+
*/
|
|
19
|
+
import { createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
import { RECIPE_CONTENT_MAX, RECIPE_EVIDENCE_MAX, RECIPE_NAME_MAX, RECIPE_SERVICE_NAME_MAX, RECIPE_SERVICES_MAX, RECIPE_SUMMARY_MAX, } from './types.js';
|
|
22
|
+
export function createRecipesMutationCounts() {
|
|
23
|
+
return { created: 0, updated: 0, linked: 0, unlinked: 0 };
|
|
24
|
+
}
|
|
25
|
+
const servicesSchema = z
|
|
26
|
+
.array(z.string().min(1).max(RECIPE_SERVICE_NAME_MAX))
|
|
27
|
+
.max(RECIPE_SERVICES_MAX)
|
|
28
|
+
.describe('Sorted list of canonical service/tool/library names this recipe chains together (e.g. ["ElevenLabs","ffmpeg","Whisper"]). Sort alphabetically.');
|
|
29
|
+
function normalizeServices(services) {
|
|
30
|
+
const cleaned = services.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
31
|
+
return Array.from(new Set(cleaned)).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
32
|
+
}
|
|
33
|
+
function textError(message) {
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: 'text', text: message }],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function textOk(message) {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: 'text', text: message }],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function createGetRecipeDetailTool(ctx, teamRecipeIds) {
|
|
45
|
+
return tool('get_recipe_detail', 'Fetch the full markdown content of an existing team recipe by id. Call this when the prompt summary is not enough to decide between link / update / create.', {
|
|
46
|
+
recipe_id: z.string().uuid().describe('id from the team recipe list'),
|
|
47
|
+
}, async (args) => {
|
|
48
|
+
if (!teamRecipeIds.has(args.recipe_id)) {
|
|
49
|
+
return textError(`recipe_id ${args.recipe_id} is not in this team's recipe list.`);
|
|
50
|
+
}
|
|
51
|
+
const { data, error } = await ctx.supabase
|
|
52
|
+
.from('recipes')
|
|
53
|
+
.select('id, name, summary, content, services')
|
|
54
|
+
.eq('id', args.recipe_id)
|
|
55
|
+
.eq('team_id', ctx.teamId)
|
|
56
|
+
.maybeSingle();
|
|
57
|
+
if (error) {
|
|
58
|
+
return textError(`Failed to read recipe: ${error.message}`);
|
|
59
|
+
}
|
|
60
|
+
if (!data) {
|
|
61
|
+
return textError(`Recipe ${args.recipe_id} not found.`);
|
|
62
|
+
}
|
|
63
|
+
return textOk(JSON.stringify(data));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export function createCreateRecipeTool(ctx, counts, teamRecipeIds) {
|
|
67
|
+
return tool('create_recipe', 'Register a brand-new recipe in the team library AND link it to this product. Use only when no existing recipe matches the capability. Pass a fully-formed recipe — name, one-paragraph summary, markdown content, sorted services list, and product-specific evidence.', {
|
|
68
|
+
name: z.string().min(1).max(RECIPE_NAME_MAX),
|
|
69
|
+
summary: z.string().min(1).max(RECIPE_SUMMARY_MAX),
|
|
70
|
+
content: z.string().min(1).max(RECIPE_CONTENT_MAX),
|
|
71
|
+
services: servicesSchema,
|
|
72
|
+
evidence: z
|
|
73
|
+
.string()
|
|
74
|
+
.min(1)
|
|
75
|
+
.max(RECIPE_EVIDENCE_MAX)
|
|
76
|
+
.describe('Plain-text paragraph saying where in THIS product the recipe shows up (file paths, entry points).'),
|
|
77
|
+
}, async (args) => {
|
|
78
|
+
const services = normalizeServices(args.services);
|
|
79
|
+
const insertRecipe = await ctx.supabase
|
|
80
|
+
.from('recipes')
|
|
81
|
+
.insert({
|
|
82
|
+
team_id: ctx.teamId,
|
|
83
|
+
name: args.name.trim(),
|
|
84
|
+
summary: args.summary.trim(),
|
|
85
|
+
content: args.content,
|
|
86
|
+
services,
|
|
87
|
+
created_by: ctx.createdBy,
|
|
88
|
+
})
|
|
89
|
+
.select('id')
|
|
90
|
+
.single();
|
|
91
|
+
if (insertRecipe.error || !insertRecipe.data) {
|
|
92
|
+
return textError(`Failed to create recipe: ${insertRecipe.error?.message ?? 'unknown error'}`);
|
|
93
|
+
}
|
|
94
|
+
const recipeId = insertRecipe.data.id;
|
|
95
|
+
const linkErr = await ctx.supabase.from('product_recipes').insert({
|
|
96
|
+
product_id: ctx.productId,
|
|
97
|
+
recipe_id: recipeId,
|
|
98
|
+
evidence: args.evidence.trim(),
|
|
99
|
+
});
|
|
100
|
+
if (linkErr.error) {
|
|
101
|
+
return textError(`Recipe created (${recipeId}) but linking to product failed: ${linkErr.error.message}`);
|
|
102
|
+
}
|
|
103
|
+
teamRecipeIds.add(recipeId);
|
|
104
|
+
counts.created += 1;
|
|
105
|
+
return textOk(`Created recipe ${recipeId} and linked to this product.`);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export function createUpdateRecipeTool(ctx, counts, teamRecipeIds) {
|
|
109
|
+
return tool('update_recipe', 'Overwrite an existing recipe (latest-wins) with better information you discovered in this repo AND link this product to it. Use when the existing entry is broadly correct but lacks detail / has outdated services / has a vague summary. Omit fields you do not want to change.', {
|
|
110
|
+
recipe_id: z.string().uuid(),
|
|
111
|
+
summary: z.string().min(1).max(RECIPE_SUMMARY_MAX).optional(),
|
|
112
|
+
content: z.string().min(1).max(RECIPE_CONTENT_MAX).optional(),
|
|
113
|
+
services: servicesSchema.optional(),
|
|
114
|
+
evidence: z.string().min(1).max(RECIPE_EVIDENCE_MAX),
|
|
115
|
+
}, async (args) => {
|
|
116
|
+
if (!teamRecipeIds.has(args.recipe_id)) {
|
|
117
|
+
return textError(`recipe_id ${args.recipe_id} is not in this team's recipe list. Use create_recipe for new entries.`);
|
|
118
|
+
}
|
|
119
|
+
const patch = {};
|
|
120
|
+
if (args.summary !== undefined) {
|
|
121
|
+
patch.summary = args.summary.trim();
|
|
122
|
+
}
|
|
123
|
+
if (args.content !== undefined) {
|
|
124
|
+
patch.content = args.content;
|
|
125
|
+
}
|
|
126
|
+
if (args.services !== undefined) {
|
|
127
|
+
patch.services = normalizeServices(args.services);
|
|
128
|
+
}
|
|
129
|
+
if (Object.keys(patch).length > 0) {
|
|
130
|
+
const updateErr = await ctx.supabase
|
|
131
|
+
.from('recipes')
|
|
132
|
+
.update(patch)
|
|
133
|
+
.eq('id', args.recipe_id)
|
|
134
|
+
.eq('team_id', ctx.teamId);
|
|
135
|
+
if (updateErr.error) {
|
|
136
|
+
return textError(`Failed to update recipe: ${updateErr.error.message}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const linkErr = await ctx.supabase.from('product_recipes').upsert({
|
|
140
|
+
product_id: ctx.productId,
|
|
141
|
+
recipe_id: args.recipe_id,
|
|
142
|
+
evidence: args.evidence.trim(),
|
|
143
|
+
}, { onConflict: 'product_id,recipe_id' });
|
|
144
|
+
if (linkErr.error) {
|
|
145
|
+
return textError(`Recipe updated but linking to product failed: ${linkErr.error.message}`);
|
|
146
|
+
}
|
|
147
|
+
counts.updated += 1;
|
|
148
|
+
return textOk(`Updated recipe ${args.recipe_id} and linked to this product.`);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
export function createLinkRecipeTool(ctx, counts, teamRecipeIds) {
|
|
152
|
+
return tool('link_recipe', 'Link this product to an existing recipe that already describes the capability accurately. Does NOT modify the recipe content. Use this whenever possible — the whole point of the team library is cross-product reuse.', {
|
|
153
|
+
recipe_id: z.string().uuid(),
|
|
154
|
+
evidence: z.string().min(1).max(RECIPE_EVIDENCE_MAX),
|
|
155
|
+
}, async (args) => {
|
|
156
|
+
if (!teamRecipeIds.has(args.recipe_id)) {
|
|
157
|
+
return textError(`recipe_id ${args.recipe_id} is not in this team's recipe list. Use create_recipe for new entries.`);
|
|
158
|
+
}
|
|
159
|
+
const linkErr = await ctx.supabase.from('product_recipes').upsert({
|
|
160
|
+
product_id: ctx.productId,
|
|
161
|
+
recipe_id: args.recipe_id,
|
|
162
|
+
evidence: args.evidence.trim(),
|
|
163
|
+
}, { onConflict: 'product_id,recipe_id' });
|
|
164
|
+
if (linkErr.error) {
|
|
165
|
+
return textError(`Failed to link recipe: ${linkErr.error.message}`);
|
|
166
|
+
}
|
|
167
|
+
counts.linked += 1;
|
|
168
|
+
return textOk(`Linked recipe ${args.recipe_id} to this product.`);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
export function createUnlinkRecipeTool(ctx, counts, existingLinkIds) {
|
|
172
|
+
return tool('unlink_recipe', 'Drop a previously-linked recipe that you have confirmed is NO LONGER present in this repo. Only call this for ids in the "Currently linked to this product" list. Does not delete the recipe itself.', {
|
|
173
|
+
recipe_id: z.string().uuid(),
|
|
174
|
+
}, async (args) => {
|
|
175
|
+
if (!existingLinkIds.has(args.recipe_id)) {
|
|
176
|
+
return textError(`recipe_id ${args.recipe_id} is not in the "Currently linked to this product" list — nothing to unlink.`);
|
|
177
|
+
}
|
|
178
|
+
const { error } = await ctx.supabase
|
|
179
|
+
.from('product_recipes')
|
|
180
|
+
.delete()
|
|
181
|
+
.eq('product_id', ctx.productId)
|
|
182
|
+
.eq('recipe_id', args.recipe_id);
|
|
183
|
+
if (error) {
|
|
184
|
+
return textError(`Failed to unlink recipe: ${error.message}`);
|
|
185
|
+
}
|
|
186
|
+
existingLinkIds.delete(args.recipe_id);
|
|
187
|
+
counts.unlinked += 1;
|
|
188
|
+
return textOk(`Unlinked recipe ${args.recipe_id} from this product.`);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
export function createRecipesMcpServer(ctx, counts, teamRecipes, existingLinkIds) {
|
|
192
|
+
const teamRecipeIds = new Set(teamRecipes.map((r) => r.id));
|
|
193
|
+
return createSdkMcpServer({
|
|
194
|
+
name: 'recipes',
|
|
195
|
+
version: '1.0.0',
|
|
196
|
+
tools: [
|
|
197
|
+
createGetRecipeDetailTool(ctx, teamRecipeIds),
|
|
198
|
+
createCreateRecipeTool(ctx, counts, teamRecipeIds),
|
|
199
|
+
createUpdateRecipeTool(ctx, counts, teamRecipeIds),
|
|
200
|
+
createLinkRecipeTool(ctx, counts, teamRecipeIds),
|
|
201
|
+
createUnlinkRecipeTool(ctx, counts, existingLinkIds),
|
|
202
|
+
],
|
|
203
|
+
});
|
|
204
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts for the recipes phase.
|
|
3
|
+
*
|
|
4
|
+
* Agent's job: explore the cloned product repo and identify each non-trivial
|
|
5
|
+
* CAPABILITY the product implements ("AI video generation", "PDF export",
|
|
6
|
+
* "real-time presence", "Stripe subscription billing", etc.) and document
|
|
7
|
+
* HOW the capability is built — which services / tools / libraries are
|
|
8
|
+
* chained together. NOT a tech-stack inventory.
|
|
9
|
+
*
|
|
10
|
+
* The agent is fed the team's existing recipes (compact form: id + name +
|
|
11
|
+
* summary + services) and must, for each capability it identifies, pick one
|
|
12
|
+
* of:
|
|
13
|
+
* - link_recipe — existing recipe describes this capability correctly,
|
|
14
|
+
* just record this product uses it
|
|
15
|
+
* - update_recipe — existing recipe is close but the agent has better /
|
|
16
|
+
* more accurate info from this repo; overwrite
|
|
17
|
+
* - create_recipe — no existing recipe matches; new entry
|
|
18
|
+
* - unlink_recipe — this product was previously linked to a recipe that
|
|
19
|
+
* is no longer present in the repo
|
|
20
|
+
*
|
|
21
|
+
* Submission is via MCP tool calls only — no fenced JSON.
|
|
22
|
+
*/
|
|
23
|
+
import type { RecipeSummary } from './types.js';
|
|
24
|
+
export interface RecipesPromptContext {
|
|
25
|
+
productName: string;
|
|
26
|
+
productDescription?: string;
|
|
27
|
+
guidance?: string;
|
|
28
|
+
teamRecipes: RecipeSummary[];
|
|
29
|
+
existingLinks: {
|
|
30
|
+
recipeId: string;
|
|
31
|
+
name: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
export declare function createRecipesSystemPrompt(): string;
|
|
35
|
+
export declare function createRecipesUserPrompt(ctx: RecipesPromptContext): string;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts for the recipes phase.
|
|
3
|
+
*
|
|
4
|
+
* Agent's job: explore the cloned product repo and identify each non-trivial
|
|
5
|
+
* CAPABILITY the product implements ("AI video generation", "PDF export",
|
|
6
|
+
* "real-time presence", "Stripe subscription billing", etc.) and document
|
|
7
|
+
* HOW the capability is built — which services / tools / libraries are
|
|
8
|
+
* chained together. NOT a tech-stack inventory.
|
|
9
|
+
*
|
|
10
|
+
* The agent is fed the team's existing recipes (compact form: id + name +
|
|
11
|
+
* summary + services) and must, for each capability it identifies, pick one
|
|
12
|
+
* of:
|
|
13
|
+
* - link_recipe — existing recipe describes this capability correctly,
|
|
14
|
+
* just record this product uses it
|
|
15
|
+
* - update_recipe — existing recipe is close but the agent has better /
|
|
16
|
+
* more accurate info from this repo; overwrite
|
|
17
|
+
* - create_recipe — no existing recipe matches; new entry
|
|
18
|
+
* - unlink_recipe — this product was previously linked to a recipe that
|
|
19
|
+
* is no longer present in the repo
|
|
20
|
+
*
|
|
21
|
+
* Submission is via MCP tool calls only — no fenced JSON.
|
|
22
|
+
*/
|
|
23
|
+
export function createRecipesSystemPrompt() {
|
|
24
|
+
return `You are a senior staff engineer cataloguing the IMPLEMENTATION RECIPES a product uses.
|
|
25
|
+
|
|
26
|
+
The current working directory is a fresh clone of the product's repository. Use Glob/Grep/Read (and Bash for git/log when helpful) to explore it before writing.
|
|
27
|
+
|
|
28
|
+
## What is a "recipe"?
|
|
29
|
+
|
|
30
|
+
A recipe describes ONE non-trivial capability the product delivers, and HOW it is built: which services, libraries, tools, and techniques are chained together to make it work end-to-end.
|
|
31
|
+
|
|
32
|
+
Good recipe names: "AI video generation", "PDF export with custom fonts", "Real-time collaborative editing", "Stripe subscription billing with proration", "GitHub OAuth device flow".
|
|
33
|
+
Bad recipe names: "React frontend", "TypeScript", "Tailwind", "Authentication" (too vague).
|
|
34
|
+
|
|
35
|
+
A recipe is the WHAT + HOW pair. The WHAT is the user-facing capability. The HOW is the specific stack of services chained to deliver it. Two products can implement the same capability with the same stack — that is one recipe, linked from both products. Two products that implement "OCR" but one uses Tesseract and the other uses PaddleOCR are TWO different recipes (same capability name, different services).
|
|
36
|
+
|
|
37
|
+
## Output protocol
|
|
38
|
+
|
|
39
|
+
The MCP server exposes these tools — use them, do NOT paste content as fenced code:
|
|
40
|
+
|
|
41
|
+
1. \`get_recipe_detail({ recipe_id })\` — fetch the full content of an existing recipe when you need to decide whether to link, update, or create. The prompt only gives you names + summaries + services to keep your context small.
|
|
42
|
+
|
|
43
|
+
2. \`create_recipe({ name, summary, content, services, evidence })\` — register a brand-new recipe in the team library AND link this product to it.
|
|
44
|
+
|
|
45
|
+
3. \`update_recipe({ recipe_id, summary?, content?, services?, evidence })\` — overwrite an existing recipe with better information you discovered in this repo AND link this product to it. Use when the existing recipe is broadly correct but lacks detail / has outdated services / has a vague summary.
|
|
46
|
+
|
|
47
|
+
4. \`link_recipe({ recipe_id, evidence })\` — just link this product to an existing recipe that already describes the capability accurately. The recipe's content is not touched.
|
|
48
|
+
|
|
49
|
+
5. \`unlink_recipe({ recipe_id })\` — drop a previously-linked recipe that the agent has confirmed is NO LONGER present in this repo (capability was removed, or the previous scan was wrong). Only unlink things in the "Currently linked to this product" list.
|
|
50
|
+
|
|
51
|
+
Call exactly one of create / update / link for each capability you identify. Call unlink at the end for any previously-linked recipe you could not corroborate. When you are done with every capability and every unlink, end your turn — no summary message, no JSON dump.
|
|
52
|
+
|
|
53
|
+
## Rules
|
|
54
|
+
|
|
55
|
+
- \`services\` is a SORTED list of canonical service / tool / library names ("ElevenLabs", "ffmpeg", "Whisper", "Stripe", "Resend"). Sort alphabetically so equivalent recipes compare cleanly. Don't include language/framework names ("React", "Node") unless they're the actual differentiator.
|
|
56
|
+
- \`content\` is markdown. Aim for 200–800 words per recipe. Structure: a short intro sentence, then numbered steps describing the flow, then a "Files" subsection with relative paths (e.g. \`src/services/video/encoder.ts\`).
|
|
57
|
+
- \`evidence\` is one paragraph of plain text saying where in THIS product's repo the recipe shows up: file paths, key entry points. Used to help reviewers verify the link.
|
|
58
|
+
- Don't invent capabilities. If the repo is small or only does one thing, emit one recipe — don't pad.
|
|
59
|
+
- Prefer LINK over UPDATE over CREATE in that order. Reuse the team library aggressively; the whole point is cross-product visibility into the same recipe.
|
|
60
|
+
- When the same capability is implemented with a clearly different stack, that's a NEW recipe even if the name collides. Disambiguate the name (\"PDF export (Puppeteer)\" vs \"PDF export (pdf-lib)\") so the team can tell them apart.`;
|
|
61
|
+
}
|
|
62
|
+
export function createRecipesUserPrompt(ctx) {
|
|
63
|
+
const lines = [];
|
|
64
|
+
lines.push(`# Product: ${ctx.productName}`);
|
|
65
|
+
if (ctx.productDescription) {
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push('## Description');
|
|
68
|
+
lines.push(ctx.productDescription);
|
|
69
|
+
}
|
|
70
|
+
if (ctx.guidance && ctx.guidance.trim()) {
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push('## Reviewer guidance (focus or exclusions)');
|
|
73
|
+
lines.push(ctx.guidance.trim());
|
|
74
|
+
}
|
|
75
|
+
lines.push('');
|
|
76
|
+
lines.push('## Existing recipes in this team');
|
|
77
|
+
if (ctx.teamRecipes.length === 0) {
|
|
78
|
+
lines.push('(none — every recipe you identify will be a `create_recipe`.)');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
lines.push('Prefer `link_recipe` / `update_recipe` over `create_recipe` when one of these matches the capability you found. Call `get_recipe_detail` if you need to see the full content before deciding.');
|
|
82
|
+
lines.push('');
|
|
83
|
+
for (const r of ctx.teamRecipes) {
|
|
84
|
+
const svc = r.services.length > 0 ? ` services=[${r.services.join(', ')}]` : '';
|
|
85
|
+
const sum = r.summary ? ` — ${r.summary}` : '';
|
|
86
|
+
lines.push(`- id=${r.id} "${r.name}"${svc}${sum}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
lines.push('');
|
|
90
|
+
lines.push('## Currently linked to this product');
|
|
91
|
+
if (ctx.existingLinks.length === 0) {
|
|
92
|
+
lines.push('(none)');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
lines.push('If you confirm any of these is no longer present in the repo, call `unlink_recipe` with its id.');
|
|
96
|
+
lines.push('');
|
|
97
|
+
for (const l of ctx.existingLinks) {
|
|
98
|
+
lines.push(`- id=${l.recipeId} "${l.name}"`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
lines.push('');
|
|
102
|
+
lines.push('## Task');
|
|
103
|
+
lines.push('Explore the cloned repository, identify every non-trivial capability the product delivers, and for each call exactly one of `create_recipe` / `update_recipe` / `link_recipe`. Then call `unlink_recipe` for any previously-linked recipe you could not corroborate. End your turn when done.');
|
|
104
|
+
return lines.join('\n');
|
|
105
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shapes the recipes MCP tools accept and return. The Zod schemas live in
|
|
3
|
+
* mcp-server.ts; these plain TS types are what the rest of the phase
|
|
4
|
+
* (orchestrator, persistence helpers, tests) consumes so they don't have
|
|
5
|
+
* to inflate Zod into their dependency graph.
|
|
6
|
+
*/
|
|
7
|
+
export interface RecipeSummary {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
summary: string | null;
|
|
11
|
+
services: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface RecipeDetail extends RecipeSummary {
|
|
14
|
+
content: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateRecipeArgs {
|
|
17
|
+
name: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
content: string;
|
|
20
|
+
services: string[];
|
|
21
|
+
evidence: string;
|
|
22
|
+
}
|
|
23
|
+
export interface UpdateRecipeArgs {
|
|
24
|
+
recipeId: string;
|
|
25
|
+
summary?: string;
|
|
26
|
+
content?: string;
|
|
27
|
+
services?: string[];
|
|
28
|
+
evidence: string;
|
|
29
|
+
}
|
|
30
|
+
export interface LinkRecipeArgs {
|
|
31
|
+
recipeId: string;
|
|
32
|
+
evidence: string;
|
|
33
|
+
}
|
|
34
|
+
export interface UnlinkRecipeArgs {
|
|
35
|
+
recipeId: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const RECIPE_SUMMARY_MAX = 500;
|
|
38
|
+
export declare const RECIPE_CONTENT_MAX = 50000;
|
|
39
|
+
export declare const RECIPE_NAME_MAX = 200;
|
|
40
|
+
export declare const RECIPE_SERVICES_MAX = 20;
|
|
41
|
+
export declare const RECIPE_SERVICE_NAME_MAX = 80;
|
|
42
|
+
export declare const RECIPE_EVIDENCE_MAX = 4000;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shapes the recipes MCP tools accept and return. The Zod schemas live in
|
|
3
|
+
* mcp-server.ts; these plain TS types are what the rest of the phase
|
|
4
|
+
* (orchestrator, persistence helpers, tests) consumes so they don't have
|
|
5
|
+
* to inflate Zod into their dependency graph.
|
|
6
|
+
*/
|
|
7
|
+
// Defensive caps mirroring the DB CHECK constraints from
|
|
8
|
+
// 20260521000000_create_recipes.sql. Keeping the limits here lets the MCP
|
|
9
|
+
// tool reject oversized output with an actionable error message instead of
|
|
10
|
+
// getting a Postgres constraint violation.
|
|
11
|
+
export const RECIPE_SUMMARY_MAX = 500;
|
|
12
|
+
export const RECIPE_CONTENT_MAX = 50_000;
|
|
13
|
+
export const RECIPE_NAME_MAX = 200;
|
|
14
|
+
export const RECIPE_SERVICES_MAX = 20;
|
|
15
|
+
export const RECIPE_SERVICE_NAME_MAX = 80;
|
|
16
|
+
export const RECIPE_EVIDENCE_MAX = 4000;
|
|
@@ -42,10 +42,10 @@ export declare function createSubmitScreenFlowTool(state: ScreenFlowCaptureState
|
|
|
42
42
|
file: z.ZodOptional<z.ZodString>;
|
|
43
43
|
kind: z.ZodEnum<{
|
|
44
44
|
page: "page";
|
|
45
|
+
state: "state";
|
|
45
46
|
modal: "modal";
|
|
46
47
|
drawer: "drawer";
|
|
47
48
|
tab: "tab";
|
|
48
|
-
state: "state";
|
|
49
49
|
}>;
|
|
50
50
|
layout: z.ZodEnum<{
|
|
51
51
|
split: "split";
|
|
@@ -30,7 +30,7 @@ export async function getBranches(options) {
|
|
|
30
30
|
// Fall through to MCP
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
if (branches
|
|
33
|
+
if (!branches) {
|
|
34
34
|
const result = (await callMcpEndpoint('branches/list', {
|
|
35
35
|
issue_id: issueId,
|
|
36
36
|
}));
|
|
@@ -79,7 +79,7 @@ export async function createBranches(options, branches) {
|
|
|
79
79
|
// Fall through to MCP
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
if (createdBranches
|
|
82
|
+
if (!createdBranches) {
|
|
83
83
|
const result = (await callMcpEndpoint('branches/create', {
|
|
84
84
|
issue_id: issueId,
|
|
85
85
|
branches,
|
|
@@ -119,7 +119,7 @@ export async function updateBranch(branchId, updates, verbose) {
|
|
|
119
119
|
// Fall through to MCP
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
if (updated
|
|
122
|
+
if (!updated) {
|
|
123
123
|
const result = (await callMcpEndpoint('branches/update', {
|
|
124
124
|
branch_id: branchId,
|
|
125
125
|
...updates,
|
|
@@ -7,7 +7,7 @@ import { DEFAULT_MODEL } from '../../constants.js';
|
|
|
7
7
|
import { logDebug } from '../../utils/logger.js';
|
|
8
8
|
import { loadSkillFile } from './plugin-loader.js';
|
|
9
9
|
const defaultDeps = {
|
|
10
|
-
loadSkillFile
|
|
10
|
+
loadSkillFile,
|
|
11
11
|
queryFn: query,
|
|
12
12
|
};
|
|
13
13
|
// ---- Prompt building (pure) ----
|
|
@@ -30,7 +30,7 @@ export async function getPullRequests(options) {
|
|
|
30
30
|
// Fall through to MCP
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
if (pullRequests
|
|
33
|
+
if (!pullRequests) {
|
|
34
34
|
const result = (await callMcpEndpoint('pull_requests/list', {
|
|
35
35
|
issue_id: issueId,
|
|
36
36
|
}));
|
|
@@ -66,7 +66,7 @@ export async function createPullRequests(options, pullRequests) {
|
|
|
66
66
|
// Fall through to MCP
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
if (created
|
|
69
|
+
if (!created) {
|
|
70
70
|
const result = (await callMcpEndpoint('pull_requests/create', {
|
|
71
71
|
issue_id: issueId,
|
|
72
72
|
pull_requests: pullRequests,
|
|
@@ -106,7 +106,7 @@ export async function updatePullRequest(prId, updates, verbose) {
|
|
|
106
106
|
// Fall through to MCP
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
if (updated
|
|
109
|
+
if (!updated) {
|
|
110
110
|
const result = (await callMcpEndpoint('pull_requests/update', {
|
|
111
111
|
pull_request_id: prId,
|
|
112
112
|
...updates,
|
package/package.json
CHANGED
package/vitest.config.ts
CHANGED
|
@@ -16,6 +16,7 @@ export default defineConfig({
|
|
|
16
16
|
'src/phases/sync-sentry-issues/__tests__/**/*.test.ts',
|
|
17
17
|
'src/phases/sync-shared/__tests__/**/*.test.ts',
|
|
18
18
|
'src/phases/screen-flow/__tests__/**/*.test.ts',
|
|
19
|
+
'src/phases/recipes/__tests__/**/*.test.ts',
|
|
19
20
|
'src/types/__tests__/**/*.test.ts',
|
|
20
21
|
'src/commands/find-smells/__tests__/**/*.test.ts',
|
|
21
22
|
],
|