testing grain.md
This commit is contained in:
1 parent
b176d30798
commit
ffff6bc3c2
2 files changed
+597
No files matched your search
@@ -0,0 +1,124 @@
|
|||||||
|
---
|
||||||
|
name: Rye Berry Grain Spawn
|
||||||
|
type: grain
|
||||||
|
difficulty: beginner
|
||||||
|
meta:
|
||||||
|
soak: "12–24 hours"
|
||||||
|
simmer: "20–30 min"
|
||||||
|
fill: "55%"
|
||||||
|
pc: "90 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Rye berries", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [rye, classic, beginner-friendly]
|
||||||
|
---
|
||||||
|
|
||||||
|
A classic grain spawn recipe using rye berries. Rye is preferred for its consistent size and excellent moisture retention. The gypsum helps prevent clumping and provides calcium for mycelial health.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Wheat Berry Grain Spawn
|
||||||
|
type: grain
|
||||||
|
difficulty: beginner
|
||||||
|
meta:
|
||||||
|
soak: "8–12 hours"
|
||||||
|
simmer: "15–20 min"
|
||||||
|
fill: "55%"
|
||||||
|
pc: "90 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Wheat berries", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [wheat, budget-friendly, beginner-friendly]
|
||||||
|
---
|
||||||
|
|
||||||
|
Budget-friendly alternative to rye with similar performance. Widely available at feed stores and bulk bins.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
name: WBS (Wild Bird Seed)
|
||||||
|
type: grain
|
||||||
|
difficulty: beginner
|
||||||
|
meta:
|
||||||
|
soak: "12–24 hours"
|
||||||
|
simmer: "10–15 min"
|
||||||
|
fill: "60%"
|
||||||
|
pc: "90 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Wild bird seed mix (no sunflower)", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [wbs, birdseed, cheap, beginner-friendly, shake-friendly]
|
||||||
|
---
|
||||||
|
|
||||||
|
The cheapest grain spawn option. Look for mixes without sunflower seeds (high oil = contamination risk). The varied particle sizes create excellent gas exchange and fast colonization.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Millet Grain Spawn
|
||||||
|
type: grain
|
||||||
|
difficulty: intermediate
|
||||||
|
meta:
|
||||||
|
soak: "12–18 hours"
|
||||||
|
simmer: "10–15 min"
|
||||||
|
fill: "65%"
|
||||||
|
pc: "90 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Millet (white or red)", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [millet, small-grain, fast-colonization, intermediate]
|
||||||
|
---
|
||||||
|
|
||||||
|
Small grain size provides exponentially more inoculation points than larger grains. Millet colonizes incredibly fast and is preferred by advanced growers for grain-to-grain transfers.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Sorghum (Milo) Grain Spawn
|
||||||
|
type: grain
|
||||||
|
difficulty: intermediate
|
||||||
|
meta:
|
||||||
|
soak: "8–12 hours"
|
||||||
|
simmer: "15–20 min"
|
||||||
|
fill: "55%"
|
||||||
|
pc: "90 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Sorghum / milo", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [sorghum, milo, drought-resistant, southern-friendly]
|
||||||
|
---
|
||||||
|
|
||||||
|
Popular in southern states where sorghum is common. Hard outer shell resists contamination better than softer grains. Requires thorough hydration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Popcorn Grain Spawn
|
||||||
|
type: grain
|
||||||
|
difficulty: beginner
|
||||||
|
meta:
|
||||||
|
soak: "24 hours"
|
||||||
|
simmer: "45–60 min"
|
||||||
|
fill: "50%"
|
||||||
|
pc: "120 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Popcorn kernels", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [popcorn, grocery-store, huge, forgiving]
|
||||||
|
---
|
||||||
|
|
||||||
|
Grocery store grain spawn. Popcorn's large size is forgiving for beginners but slows colonization. The hard hull requires extra long PC time to ensure full sterilization.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
name: Brown Rice Grain Spawn
|
||||||
|
type: grain
|
||||||
|
difficulty: beginner
|
||||||
|
meta:
|
||||||
|
soak: "12–18 hours"
|
||||||
|
simmer: "10–15 min"
|
||||||
|
fill: "50%"
|
||||||
|
pc: "90 min @ 15 PSI"
|
||||||
|
ingredients:
|
||||||
|
- { item: "Brown rice (short grain)", amount: "1 lb", type: "base" }
|
||||||
|
- { item: "Gypsum", amount: "1 tsp", type: "supplement" }
|
||||||
|
tags: [rice, brown-rice, ub-tek-compatible, soft-grain]
|
||||||
|
---
|
||||||
|
|
||||||
|
Soft grain that hydrates quickly. Commonly used in UB Tek-style pre-cooked bags. Can get mushy easily — err on the side of under-hydration.
|
||||||
@@ -0,0 +1,473 @@
|
|||||||
|
/**
|
||||||
|
* Build protocol steps from recipe metadata
|
||||||
|
* Takes parsed recipe frontmatter and generates step-by-step instructions
|
||||||
|
*/
|
||||||
|
|
||||||
|
const equipmentByType = {
|
||||||
|
grain: [
|
||||||
|
'Pressure cooker / autoclave',
|
||||||
|
'Mason jars with filter lids',
|
||||||
|
'Large pot for soaking',
|
||||||
|
'Colander',
|
||||||
|
'Clean towels',
|
||||||
|
'Scale',
|
||||||
|
'Still air box or flow hood (optional)'
|
||||||
|
],
|
||||||
|
lc: [
|
||||||
|
'Pressure cooker / autoclave',
|
||||||
|
'Glass LC vessels or jars',
|
||||||
|
'Magnetic stir bar (optional)',
|
||||||
|
'Self-healing injection ports',
|
||||||
|
'Polyfill or filter discs',
|
||||||
|
'Scale',
|
||||||
|
'pH strips or meter (optional)',
|
||||||
|
'Still air box or flow hood (optional)'
|
||||||
|
],
|
||||||
|
aio: [
|
||||||
|
'Pressure cooker / autoclave (unless using UB Tek)',
|
||||||
|
'Sealable bags or jars',
|
||||||
|
'LC syringe',
|
||||||
|
'Micropore tape',
|
||||||
|
'Scale',
|
||||||
|
'Still air box or flow hood (optional)'
|
||||||
|
],
|
||||||
|
substrate: [
|
||||||
|
'Large tub or barrel for pasteurization',
|
||||||
|
'Thermometer',
|
||||||
|
'Colander',
|
||||||
|
'Clean towels',
|
||||||
|
'Fruiting containers or bags',
|
||||||
|
'Spawn (fully colonized grain)',
|
||||||
|
'pH strips or meter (optional)'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
const timeEstimates = {
|
||||||
|
grain: { prep: '2–4 hours', sterilization: '1.5–2 hours', cooling: '4–8 hours', total: '8–14 hours' },
|
||||||
|
lc: { prep: '20–30 min', sterilization: '30 min', cooling: '2–4 hours', total: '3–5 hours' },
|
||||||
|
aio: { prep: '2–6 hours', sterilization: '2–2.5 hours', cooling: '6–12 hours', colonization: '14–30 days', total: '15–31 days' },
|
||||||
|
substrate: { prep: '1–2 hours', pasteurization: '1–2 hours', cooling: '4–8 hours', colonization: '7–21 days', total: '8–24 days' }
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build protocol header with equipment list and time estimates
|
||||||
|
* @param {Object} recipe - Parsed recipe object from YAML frontmatter
|
||||||
|
* @returns {Object} header with equipment array and times object
|
||||||
|
*/
|
||||||
|
function buildProtocolHeader(recipe) {
|
||||||
|
const type = recipe.type;
|
||||||
|
const baseEquipment = equipmentByType[type] || [];
|
||||||
|
const times = timeEstimates[type] || {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
equipment: baseEquipment,
|
||||||
|
times: times
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build protocol steps array based on recipe type and metadata
|
||||||
|
* @param {Object} recipe - Parsed recipe object from YAML frontmatter
|
||||||
|
* @returns {Array} Array of step objects
|
||||||
|
*/
|
||||||
|
function buildProtocolSteps(recipe) {
|
||||||
|
const type = recipe.type;
|
||||||
|
const meta = recipe.meta || {};
|
||||||
|
const steps = [];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'grain':
|
||||||
|
// Step 1: Soak
|
||||||
|
if (meta.soak) {
|
||||||
|
steps.push({
|
||||||
|
text: `Soak grain in clean water for ${meta.soak}.`,
|
||||||
|
time: meta.soak,
|
||||||
|
critical: false,
|
||||||
|
note: 'Room temperature water. Drain completely when done.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Simmer
|
||||||
|
if (meta.simmer) {
|
||||||
|
steps.push({
|
||||||
|
text: `Bring to a boil then simmer for ${meta.simmer} until kernels swell.`,
|
||||||
|
time: `${parseInt(meta.simmer) + 5} min`,
|
||||||
|
critical: false,
|
||||||
|
note: 'Do not over-simmer — mushy grain contaminates easily.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Drain and dry
|
||||||
|
steps.push({
|
||||||
|
text: 'Drain thoroughly and spread on clean towels to surface-dry.',
|
||||||
|
time: '30–60 min',
|
||||||
|
critical: true,
|
||||||
|
note: 'Grain should be dry to touch outside, moist inside.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 4: Load jars
|
||||||
|
if (meta.fill) {
|
||||||
|
steps.push({
|
||||||
|
text: `Load jars to ${meta.fill} capacity. Apply filter disc and secure lids.`,
|
||||||
|
time: '10 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Leave headspace for gas exchange. Do not overtighten.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 5: PC
|
||||||
|
if (meta.pc) {
|
||||||
|
steps.push({
|
||||||
|
text: `Pressure cook at ${meta.pc}.`,
|
||||||
|
time: meta.pc,
|
||||||
|
critical: true,
|
||||||
|
note: 'Start timing when pressure reaches 15 PSI.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 6: Cool
|
||||||
|
steps.push({
|
||||||
|
text: 'Allow jars to cool completely to room temperature.',
|
||||||
|
time: '4–8 hours',
|
||||||
|
critical: false,
|
||||||
|
note: 'Do not open PC until fully depressurized and cooled.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 7: Inoculate
|
||||||
|
steps.push({
|
||||||
|
text: 'Inoculate with spores or liquid culture in sterile conditions.',
|
||||||
|
time: '5 min',
|
||||||
|
critical: true,
|
||||||
|
note: 'Work near flame. Shake syringe before injecting.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 8: Colonize
|
||||||
|
steps.push({
|
||||||
|
text: 'Incubate at 75–80°F until fully colonized.',
|
||||||
|
time: '7–14 days',
|
||||||
|
critical: false,
|
||||||
|
note: 'Look for pinning as sign of readiness for fruiting.'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'lc':
|
||||||
|
// Step 1: Mix
|
||||||
|
const baseIngredients = recipe.ingredients.filter(i => i.type === 'base');
|
||||||
|
steps.push({
|
||||||
|
text: `Mix ${baseIngredients.map(i => `${i.amount} ${i.item}`).join(', ')} until dissolved.`,
|
||||||
|
time: '5 min',
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 2: Add stir bar (optional)
|
||||||
|
if (meta.stirbar === 'Yes' || meta.stirbar === 'optional') {
|
||||||
|
steps.push({
|
||||||
|
text: 'Add sterile magnetic stir bar (optional).',
|
||||||
|
time: '1 min',
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Cap
|
||||||
|
steps.push({
|
||||||
|
text: 'Cap with injection port and filter in place.',
|
||||||
|
time: '2 min',
|
||||||
|
critical: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 4: Sterilize
|
||||||
|
if (meta.sterilization) {
|
||||||
|
steps.push({
|
||||||
|
text: `Sterilize: ${meta.sterilization}.`,
|
||||||
|
time: meta.sterilization,
|
||||||
|
critical: true,
|
||||||
|
note: 'Do not exceed time — sugar will caramelize.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 5: Cool
|
||||||
|
steps.push({
|
||||||
|
text: 'Cool to room temperature.',
|
||||||
|
time: '2–4 hours',
|
||||||
|
critical: false,
|
||||||
|
note: 'Verify liquid is at room temp before inoculation.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 6: Inoculate
|
||||||
|
steps.push({
|
||||||
|
text: 'Inoculate with spores or mycelium in sterile conditions.',
|
||||||
|
time: '5 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Flame sterilize needle between jars.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 7: Incubate
|
||||||
|
steps.push({
|
||||||
|
text: 'Incubate at 75–80°F with daily agitation.',
|
||||||
|
time: '7–14 days',
|
||||||
|
critical: false,
|
||||||
|
note: 'Swirl or use stir plate to prevent clumping.'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'aio':
|
||||||
|
// Check if UB Tek (no PC)
|
||||||
|
const isUBTek = recipe.tags?.includes('ub-tek') || recipe.ingredients.some(i => i.item.toLowerCase().includes("uncle ben"));
|
||||||
|
|
||||||
|
if (isUBTek) {
|
||||||
|
// UB Tek specific steps
|
||||||
|
steps.push({
|
||||||
|
text: 'Break up rice inside sealed bag by massaging.',
|
||||||
|
time: '2 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Creates more inoculation points for faster colonization.'
|
||||||
|
});
|
||||||
|
|
||||||
|
steps.push({
|
||||||
|
text: 'Inject 0.5–1cc LC through bag front in sterile conditions.',
|
||||||
|
time: '5 min',
|
||||||
|
critical: true,
|
||||||
|
note: 'Wipe injection site with alcohol. Flame sterilize needle.'
|
||||||
|
});
|
||||||
|
|
||||||
|
steps.push({
|
||||||
|
text: 'Cover hole with micropore tape.',
|
||||||
|
time: '1 min',
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Jar/bag AIO with PC
|
||||||
|
// Step 1: Soak grain
|
||||||
|
if (meta.soak) {
|
||||||
|
steps.push({
|
||||||
|
text: `Soak grain portion for ${meta.soak}.`,
|
||||||
|
time: meta.soak,
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Simmer grain
|
||||||
|
if (meta.simmer) {
|
||||||
|
steps.push({
|
||||||
|
text: `Simmer grain for ${meta.simmer}.`,
|
||||||
|
time: meta.simmer,
|
||||||
|
critical: false,
|
||||||
|
note: 'Until just starting to crack. Not mushy.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Prep substrate
|
||||||
|
steps.push({
|
||||||
|
text: 'Hydrate substrate ingredients to field capacity.',
|
||||||
|
time: '20 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Firm squeeze yields 1–2 drops.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 4: Layer
|
||||||
|
if (meta.fill) {
|
||||||
|
steps.push({
|
||||||
|
text: `Layer grain and substrate to ${meta.fill} capacity.`,
|
||||||
|
time: '10 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Grain at bottom for easy break-and-shake.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 5: PC
|
||||||
|
if (meta.pc) {
|
||||||
|
steps.push({
|
||||||
|
text: `Pressure cook at ${meta.pc}.`,
|
||||||
|
time: meta.pc,
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 6: Cool
|
||||||
|
steps.push({
|
||||||
|
text: 'Cool to room temperature.',
|
||||||
|
time: '6–12 hours',
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 7: Inoculate
|
||||||
|
steps.push({
|
||||||
|
text: 'Inoculate grain layer in sterile conditions.',
|
||||||
|
time: '5 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Multiple injection points through filter or self-healing port.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 8: Colonize
|
||||||
|
if (meta.colonization) {
|
||||||
|
steps.push({
|
||||||
|
text: 'Incubate until fully colonized.',
|
||||||
|
time: meta.colonization,
|
||||||
|
critical: false,
|
||||||
|
note: 'Break and shake at 30% colonization if using grain.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 9: Initiate fruiting
|
||||||
|
steps.push({
|
||||||
|
text: 'Introduce fruiting conditions by increasing fresh air exchange.',
|
||||||
|
time: 'Immediate',
|
||||||
|
critical: false,
|
||||||
|
note: 'Open bag or flip jar lid. No humidity intervention needed.'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'substrate':
|
||||||
|
// Step 1: Hydration
|
||||||
|
if (meta.pasteurization) {
|
||||||
|
if (meta.pasteurization.toLowerCase().includes('bucket')) {
|
||||||
|
steps.push({
|
||||||
|
text: 'Combine dry ingredients in bucket.',
|
||||||
|
time: '5 min',
|
||||||
|
critical: false
|
||||||
|
});
|
||||||
|
|
||||||
|
steps.push({
|
||||||
|
text: 'Pour boiling water to field capacity, seal, and let pasteurize overnight.',
|
||||||
|
time: '8–12 hours',
|
||||||
|
critical: false,
|
||||||
|
note: 'Core temp should drop below 100°F before opening.'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
steps.push({
|
||||||
|
text: `Pasteurize substrate at ${meta.pasteurization}.`,
|
||||||
|
time: meta.pasteurization,
|
||||||
|
critical: false,
|
||||||
|
note: 'Monitor core temperature reaches 140–170°F.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Hydrate
|
||||||
|
if (meta.moisture) {
|
||||||
|
steps.push({
|
||||||
|
text: `Hydrate to ${meta.moisture}.`,
|
||||||
|
time: '15 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Test field capacity: firm squeeze yields 1–2 drops.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Cool
|
||||||
|
steps.push({
|
||||||
|
text: 'Cool to room temperature.',
|
||||||
|
time: '4–8 hours',
|
||||||
|
critical: true,
|
||||||
|
note: 'Hot substrate will kill spawn.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 4: Mix spawn
|
||||||
|
steps.push({
|
||||||
|
text: 'Mix with fully colonized grain spawn at 10–20% spawn rate.',
|
||||||
|
time: '15 min',
|
||||||
|
critical: true,
|
||||||
|
note: 'Work in still air or with flow hood. Gloves recommended.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 5: Pack
|
||||||
|
steps.push({
|
||||||
|
text: 'Pack into fruiting containers or bags.',
|
||||||
|
time: '10 min',
|
||||||
|
critical: false,
|
||||||
|
note: 'Level surface, 3–6 inches deep.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 6: Colonize
|
||||||
|
steps.push({
|
||||||
|
text: 'Incubate at 75–80°F until fully colonized.',
|
||||||
|
time: '7–21 days',
|
||||||
|
critical: false,
|
||||||
|
note: 'Substrate should turn white with mycelium.'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Step 7: Initiate fruiting
|
||||||
|
steps.push({
|
||||||
|
text: 'Introduce fresh air exchange to initiate fruiting.',
|
||||||
|
time: 'Immediate',
|
||||||
|
critical: false,
|
||||||
|
note: 'Look for pinning as sign to start. No humidity intervention needed.'
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
steps.push({
|
||||||
|
text: 'Follow standard sterile technique throughout.',
|
||||||
|
time: 'N/A',
|
||||||
|
critical: true,
|
||||||
|
note: 'Research type-specific protocols for best results.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build complete protocol from recipe
|
||||||
|
* @param {Object} recipe - Parsed recipe object from YAML frontmatter
|
||||||
|
* @returns {Object} { header: { equipment, times }, steps: [] }
|
||||||
|
*/
|
||||||
|
function buildProtocol(recipe) {
|
||||||
|
return {
|
||||||
|
header: buildProtocolHeader(recipe),
|
||||||
|
steps: buildProtocolSteps(recipe)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render protocol to markdown format
|
||||||
|
* @param {Object} protocol - Output from buildProtocol()
|
||||||
|
* @returns {String} Formatted markdown
|
||||||
|
*/
|
||||||
|
function renderProtocolMarkdown(protocol) {
|
||||||
|
const { header, steps } = protocol;
|
||||||
|
|
||||||
|
let md = '## Protocol\n\n';
|
||||||
|
|
||||||
|
md += '### Equipment\n';
|
||||||
|
md += header.equipment.map(e => `- ${e}`).join('\n') + '\n\n';
|
||||||
|
|
||||||
|
md += '### Time Estimates\n';
|
||||||
|
Object.entries(header.times).forEach(([key, value]) => {
|
||||||
|
md += `- **${key}**: ${value}\n`;
|
||||||
|
});
|
||||||
|
md += '\n';
|
||||||
|
|
||||||
|
md += '### Steps\n\n';
|
||||||
|
steps.forEach((step, i) => {
|
||||||
|
md += `${i + 1}. **${step.text}**`;
|
||||||
|
if (step.time) md += ` *(⏱ ${step.time})*`;
|
||||||
|
md += '\n';
|
||||||
|
if (step.note) md += ` > ${step.note}\n`;
|
||||||
|
if (step.critical) md += ` ⚠️ **Critical step**\n`;
|
||||||
|
md += '\n';
|
||||||
|
});
|
||||||
|
|
||||||
|
return md;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export for Node.js
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports = {
|
||||||
|
buildProtocol,
|
||||||
|
buildProtocolHeader,
|
||||||
|
buildProtocolSteps,
|
||||||
|
renderProtocolMarkdown
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example usage (commented out):
|
||||||
|
// const recipe = {
|
||||||
|
// name: 'Rye Berry Grain Spawn',
|
||||||
|
// type: 'grain',
|
||||||
|
// difficulty: 'beginner',
|
||||||
|
// meta: { soak: '12–24 hours', simmer: '20–30 min', pc: '90 min @ 15 PSI' },
|
||||||
|
// ingredients: [],
|
||||||
|
// tags: ['rye', 'beginner-friendly']
|
||||||
|
// };
|
||||||
|
// console.log(renderProtocolMarkdown(buildProtocol(recipe)));
|
||||||
Reference in new issue
Block a user