Version 0.1
This commit is contained in:
1 parent
ffff6bc3c2
commit
ab919701da
3 files changed
+1245
-540
No files matched your search
+311
-416
@@ -1,47 +1,12 @@
|
||||
/**
|
||||
* Build protocol steps from recipe metadata
|
||||
* Takes parsed recipe frontmatter and generates step-by-step instructions
|
||||
*/
|
||||
|
||||
// Equipment lists by type
|
||||
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)'
|
||||
]
|
||||
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)']
|
||||
};
|
||||
|
||||
// Time estimates by type
|
||||
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' },
|
||||
@@ -49,425 +14,355 @@ const timeEstimates = {
|
||||
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 || {};
|
||||
// Protocol Builder
|
||||
function buildProtocol(recipe) {
|
||||
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.`,
|
||||
const meta = recipe.meta || {};
|
||||
const equipment = equipmentByType[recipe.type] || [];
|
||||
const times = timeEstimates[recipe.type] || {};
|
||||
|
||||
// Header info
|
||||
const header = {
|
||||
equipment,
|
||||
times,
|
||||
ingredients: recipe.ingredients.map(i => i.text)
|
||||
};
|
||||
|
||||
switch (recipe.type) {
|
||||
case 'grain': {
|
||||
const grainName = recipe.ingredients[0]?.text.split('—')[1]?.trim() || 'grain';
|
||||
|
||||
steps.push({
|
||||
text: `Weigh out ${grainName} and rinse under cold water until it runs clear.`,
|
||||
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',
|
||||
|
||||
if (meta.soak && meta.soak !== '0 hours') {
|
||||
const soakHours = meta.soak.replace(' hours', '');
|
||||
steps.push({
|
||||
text: `Soak in cold tap water for ${soakHours} hours.`,
|
||||
time: `${soakHours} hours`,
|
||||
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) {
|
||||
|
||||
if (meta.simmer && meta.simmer !== '0 min') {
|
||||
const simmerMin = meta.simmer.replace(' min', '');
|
||||
steps.push({
|
||||
text: `Sterilize: ${meta.sterilization}.`,
|
||||
time: meta.sterilization,
|
||||
critical: true,
|
||||
note: 'Do not exceed time — sugar will caramelize.'
|
||||
text: `Bring to a boil then simmer for ${simmerMin} minutes until kernels swell and a few just start to crack.`,
|
||||
time: `${parseInt(simmerMin) + 5} min`,
|
||||
critical: false,
|
||||
note: 'Do not over-simmer — mushy grain contaminates easily. When in doubt, under-simmer.'
|
||||
});
|
||||
}
|
||||
|
||||
// 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.'
|
||||
|
||||
steps.push({
|
||||
text: 'Drain thoroughly, spread on a clean towel and surface-dry for 20–30 min. Grains should look matte, not wet.',
|
||||
time: '25 min',
|
||||
critical: true,
|
||||
note: 'Surface moisture is the #1 cause of grain spawn failure. If grains look shiny, dry longer.'
|
||||
});
|
||||
|
||||
// Step 6: Inoculate
|
||||
|
||||
if (recipe.ingredients.some(i => i.type === 'supplement')) {
|
||||
const supps = recipe.ingredients.filter(i => i.type === 'supplement');
|
||||
steps.push({
|
||||
text: `Mix in supplements: ${supps.map(s => s.text).join(', ')}.`,
|
||||
time: '2 min',
|
||||
critical: false
|
||||
});
|
||||
}
|
||||
|
||||
steps.push({
|
||||
text: 'Inoculate with spores or mycelium in sterile conditions.',
|
||||
text: `Load jars to ${meta.fill || '55'}% capacity. Apply filter disc and secure lids finger-tight.`,
|
||||
time: '10 min',
|
||||
critical: false,
|
||||
note: 'Leave headspace for gas exchange. Do not overtighten — steam must escape during pressure cooking.'
|
||||
});
|
||||
|
||||
if (meta.pc) {
|
||||
const pcTime = meta.pc.match(/(\d+)min/)?.[1] || '90';
|
||||
steps.push({
|
||||
text: `Sterilize at ${meta.pc.replace('PC: ', '')}. Start timing when pressure reaches 15 PSI.`,
|
||||
time: `${parseInt(pcTime) + 30} min`,
|
||||
critical: false,
|
||||
});
|
||||
}
|
||||
|
||||
steps.push({
|
||||
text: 'Allow pressure cooker to cool naturally to 0 PSI before opening. Cool jars to room temperature.',
|
||||
time: '4–8 hours',
|
||||
critical: false,
|
||||
note: 'Never shake jars while hot — condensation creates wet spots.'
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: 'Inoculate when jars are at or below room temperature (<21°C). Work under still air or flow hood, if available. Flame sterilize liquid culture syringe before each injection. Inject 1–2 mL per jar.',
|
||||
time: '2–2 min per jar',
|
||||
critical: false,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'lc': {
|
||||
const waterSrc = meta.water || 'distilled water';
|
||||
const baseIngs = recipe.ingredients.filter(i => i.type === 'base');
|
||||
const totalVolume = meta.volume || '600ml per vessel';
|
||||
|
||||
steps.push({
|
||||
text: `Measure ${totalVolume} of ${waterSrc}.`,
|
||||
time: '2 min',
|
||||
critical: false
|
||||
});
|
||||
|
||||
if (baseIngs.length) {
|
||||
steps.push({
|
||||
text: `Dissolve nutrients: ${baseIngs.map(i => i.text).join(', ')}. Stir until completely clear.`,
|
||||
time: '3 min',
|
||||
critical: false
|
||||
});
|
||||
}
|
||||
|
||||
if (meta.pH) {
|
||||
steps.push({
|
||||
text: `Check and adjust pH to ${meta.pH.replace('Target pH: ', '')}.`,
|
||||
time: '3 min',
|
||||
critical: false
|
||||
});
|
||||
}
|
||||
|
||||
steps.push({
|
||||
text: meta.stirbar ? 'Add a sterile magnetic stir bar to each vessel. Fill to desired level.' : 'Fill vessels to desired level, leaving 25% headspace.',
|
||||
time: '2 min',
|
||||
critical: false
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: 'Cap with self-healing injection port and polyfill filter, or modified lid with filter patch.',
|
||||
time: '3 min',
|
||||
critical: false,
|
||||
});
|
||||
|
||||
if (meta.pc) {
|
||||
steps.push({
|
||||
text: `Sterilize at ${meta.pc.replace('PC: ', '')}.`,
|
||||
time: '45 min',
|
||||
critical: false,
|
||||
note: 'Do not exceed 30 minutes at 15 PSI — LC caramelizes easily.'
|
||||
});
|
||||
}
|
||||
|
||||
steps.push({
|
||||
text: 'Cool to room temperature before inoculation.',
|
||||
time: '2–4 hours',
|
||||
critical: true,
|
||||
note: 'Hot liquid kills mycelium.'
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: 'Inoculate with a clean agar wedge, spore syringe, or existing LC under sterile conditions.',
|
||||
time: '5 min',
|
||||
critical: false,
|
||||
note: 'Flame sterilize needle between jars.'
|
||||
note: 'Flame-sterilize the needle between vessels.'
|
||||
});
|
||||
|
||||
// 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',
|
||||
|
||||
if (meta.stirbar) {
|
||||
const rpm = meta.stirbar.match(/(\d+) RPM/)?.[1] || '150';
|
||||
steps.push({
|
||||
text: `Incubate on a magnetic stir plate at ${rpm} RPM until mycelium fills the vessel.`,
|
||||
time: '5–10 days',
|
||||
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
|
||||
note: 'Adjust RPM to create a gentle vortex without splashing.'
|
||||
});
|
||||
} 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',
|
||||
steps.push({
|
||||
text: 'Agitate daily by swirling the vessel. Ready when mycelium is abundant (cloudy/milky appearance).',
|
||||
time: '7–14 days',
|
||||
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')) {
|
||||
}
|
||||
|
||||
case 'aio': {
|
||||
const isLayered = recipe.ingredients.some(i => i.text.includes('Coco') || i.text.includes('Coir'));
|
||||
const noSteril = meta.sterilization === 'None';
|
||||
|
||||
if (noSteril) {
|
||||
steps.push({
|
||||
text: 'Obtain sealed, commercially sterile pouches. Check for intact seals and no visible contamination.',
|
||||
time: '2 min',
|
||||
critical: true,
|
||||
note: 'Inspect bags carefully. Any punctures, moisture, or discoloration = contamination risk.'
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: 'Inoculate directly through the bag using an LC syringe. Flame sterilize the syringe and then inject 2–3 mL through the injection port. Wipe injection site with alcohol before injection.',
|
||||
time: '2 min per bag',
|
||||
critical: true,
|
||||
note: ''
|
||||
});
|
||||
} else {
|
||||
const grainName = recipe.ingredients.find(i => i.text.includes('grain') || i.text.includes('Wheat') || i.text.includes('Rye') || i.text.includes('Oat'))?.text.split('—')[1]?.trim() || 'grain';
|
||||
|
||||
if (meta.soak && meta.soak !== '0 hours') {
|
||||
steps.push({
|
||||
text: `Soak ${grainName} in cold water for ${meta.soak.replace(' hours', '')} hours.`,
|
||||
time: `${meta.soak.replace(' hours', '')} hours`,
|
||||
critical: false
|
||||
});
|
||||
}
|
||||
|
||||
if (meta.simmer && meta.simmer !== '0 min') {
|
||||
steps.push({
|
||||
text: 'Combine dry ingredients in bucket.',
|
||||
text: `Simmer ${grainName} for ${meta.simmer.replace(' min', '')} minutes until grains swell but do not burst. Drain and surface-dry.`,
|
||||
time: `${parseInt(meta.simmer.replace(' min', '')) + 15} min`,
|
||||
critical: true,
|
||||
note: 'Over-hydrated grain is the #1 failure mode. Grains should feel firm, not mushy.'
|
||||
});
|
||||
}
|
||||
|
||||
if (isLayered) {
|
||||
steps.push({
|
||||
text: 'Prepare substrate layer: hydrate to field capacity. A firm squeeze should yield only 1–2 drops.',
|
||||
time: '10 min',
|
||||
critical: true,
|
||||
note: 'Too wet = bacterial bloom. Too dry = slow colonization.'
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: 'Layer into bag: grain on the bottom, substrate on top. Keep layers distinct — do not mix.',
|
||||
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.'
|
||||
}
|
||||
|
||||
steps.push({
|
||||
text: `Load into container. Leave ${meta.capacity || '20%'} headspace for gas exchange.`,
|
||||
time: '3 min',
|
||||
critical: false
|
||||
});
|
||||
|
||||
if (meta.pc) {
|
||||
const pcMatch = meta.pc.match(/(\d+)min/);
|
||||
const pcTime = pcMatch ? pcMatch[1] : '90';
|
||||
steps.push({
|
||||
text: `Sterilize at ${meta.pc.replace('PC: ', '')}.`,
|
||||
time: `${parseInt(pcTime) + 30} min`,
|
||||
critical: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: Hydrate
|
||||
if (meta.moisture) {
|
||||
|
||||
steps.push({
|
||||
text: 'Cool to room temperature before inoculation.',
|
||||
time: '6–12 hours',
|
||||
critical: true,
|
||||
note: 'Substrate and grain must be fully cooled — heat kills mycelium.'
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: `Hydrate to ${meta.moisture}.`,
|
||||
time: '15 min',
|
||||
text: isLayered ? 'Inoculate the grain layer using an LC syringe. Flame sterilize the syringe and then inject 2–4 mL through the injection port. Wipe injection site with alcohol before and after. Wipe injection site with alcohol before injection.' : 'Flame sterilize the syringe and then inject 2–4 mL through the injection port. Wipe injection site with alcohol before injection.',
|
||||
time: '2 min per bag',
|
||||
critical: false,
|
||||
note: 'Test field capacity: firm squeeze yields 1–2 drops.'
|
||||
});
|
||||
}
|
||||
|
||||
// Step 3: Cool
|
||||
|
||||
steps.push({
|
||||
text: 'Cool to room temperature.',
|
||||
text: 'Seal and incubate at 21–24°C in a dark, undisturbed location.',
|
||||
time: '14–30 days',
|
||||
critical: true,
|
||||
note: 'Do NOT open to check progress — any break in the seal risks contamination.'
|
||||
});
|
||||
|
||||
steps.push({
|
||||
text: isLayered
|
||||
? 'When fully colonized, initiate fruiting: cut an X in the bag wall to expose mycelium to fresh air.'
|
||||
: 'When fully colonized, initiate fruiting: cut an X in the container to expose mycelium to fresh air.',
|
||||
time: 'N/A',
|
||||
critical: false,
|
||||
note: 'Only cut bags when 100% colonized. Premature fruiting invites contamination.'
|
||||
});
|
||||
|
||||
// Removed humidity/misting step - Cultivar handles this automatically
|
||||
break;
|
||||
}
|
||||
|
||||
case 'substrate': {
|
||||
if (meta.pasteurization) {
|
||||
const pasteurizationMethod = meta.pasteurization.replace('Pasteurization: ', '');
|
||||
steps.push({
|
||||
text: `Pasteurize using ${pasteurizationMethod}.`,
|
||||
time: '1–2 hours',
|
||||
critical: true,
|
||||
note: 'Monitor temperature closely — too hot kills everything, too cool kills nothing.'
|
||||
});
|
||||
}
|
||||
|
||||
if (meta.pc) {
|
||||
steps.push({
|
||||
text: `Sterilize at ${meta.pc.replace('PC: ', '')}.`,
|
||||
time: '2–2.5 hours',
|
||||
critical: false
|
||||
});
|
||||
}
|
||||
|
||||
if (meta.moisture && !meta.treatment) {
|
||||
steps.push({
|
||||
text: meta.moisture == 'Natural Weather' ? "" : `Hydrate to ${meta.moisture}. Test field capacity: a firm squeeze should yield only 1–2 drops.`,
|
||||
time: '15 min',
|
||||
critical: true,
|
||||
note: 'Too wet = anaerobic bacteria. Too dry = stalled colonization.'
|
||||
});
|
||||
}
|
||||
|
||||
meta.treatment ? steps.push({
|
||||
text: `Test PH to ${meta.pH} and allow to soak for ${meta.treatment}`,
|
||||
time: meta.treatment,
|
||||
critical: false,
|
||||
}) : steps.push({
|
||||
text: 'Cool to room temperature before use.',
|
||||
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.'
|
||||
meta.treatment && steps.push(
|
||||
{
|
||||
text: `Allow to drip-dry until ${meta.moisture}. Test field capacity: a firm squeeze should yield only 1-2 drops.`,
|
||||
time: '1-2 hours',
|
||||
critical: true,
|
||||
note: 'Too wet = anaerobic bacteria. Too dry = stalled colonization.'
|
||||
}
|
||||
)
|
||||
|
||||
steps.push({
|
||||
text: 'Mix with fully colonized grain spawn at 10-20% spawn rate by volume.',
|
||||
time: '5 min',
|
||||
critical: false
|
||||
});
|
||||
|
||||
// Step 5: Pack
|
||||
steps.push({
|
||||
text: 'Pack into fruiting containers or bags.',
|
||||
time: '10 min',
|
||||
critical: false,
|
||||
note: 'Level surface, 3–6 inches deep.'
|
||||
|
||||
steps.push({
|
||||
text: 'Pack into fruiting container or bag, leaving headspace for gas exchange.',
|
||||
time: '3 min',
|
||||
critical: false
|
||||
});
|
||||
|
||||
// Step 6: Colonize
|
||||
steps.push({
|
||||
text: 'Incubate at 75–80°F until fully colonized.',
|
||||
|
||||
steps.push({
|
||||
text: 'Incubate at 21–24°C until fully colonized.',
|
||||
time: '7–21 days',
|
||||
critical: false,
|
||||
note: 'Substrate should turn white with mycelium.'
|
||||
note: 'Duration depends on species and substrate depth.'
|
||||
});
|
||||
|
||||
// Step 7: Initiate fruiting
|
||||
steps.push({
|
||||
text: 'Introduce fresh air exchange to initiate fruiting.',
|
||||
time: 'Immediate',
|
||||
|
||||
steps.push({
|
||||
text: 'Initiate fruiting by introducing fresh air when substrate is fully white.',
|
||||
time: 'N/A',
|
||||
critical: false,
|
||||
note: 'Look for pinning as sign to start. No humidity intervention needed.'
|
||||
note: 'Look for pinning (small mushroom primordia) as the sign to start fruiting.'
|
||||
});
|
||||
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)));
|
||||
|
||||
return { header, steps };
|
||||
}
|
||||
Reference in new issue
Block a user