* Extract structured plan steps from any text format using LLM. * MarrowScript Feature #3: replaces regex-based parsePlan() in plan_tracker.js * with a compiled classifier that handles prose-embedded plans. * * @param {string} response - Model response that may contain a plan * @returns {Promis
(response)
| 165 | * @returns {Promise<string[]|null>} array of step strings, or null |
| 166 | */ |
| 167 | async function extractPlanSteps(response) { |
| 168 | const prompts = _getPrompts(); |
| 169 | if (!prompts) return null; |
| 170 | try { |
| 171 | const traceId = require('crypto').randomUUID(); |
| 172 | const result = await prompts.callPrompt('extract_plan', { response }, { trace_id: traceId }); |
| 173 | const clean = String(result).trim().replace(/^```[a-z]*\n?/, '').replace(/\n?```$/, ''); |
| 174 | const parsed = JSON.parse(clean); |
| 175 | if (!Array.isArray(parsed) || parsed.length < 2) return null; |
| 176 | return parsed.slice(0, 8).map(s => String(s).slice(0, 200)); |
| 177 | } catch { |
| 178 | return null; // fall back to regex parser in plan_tracker.js |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Generate a conventional commit message for the auto-commit feature. |
no test coverage detected