* Mark a requirement as complete (used internally after a cycle reaches green). * If loopActive, auto-starts the next pending requirement's cycle. * * @param {string} reqId * @returns {{ ok: boolean, advanced: boolean, next: object|null, message: string }}
(reqId)
| 165 | * @returns {{ ok: boolean, advanced: boolean, next: object|null, message: string }} |
| 166 | */ |
| 167 | _completeRequirement(reqId) { |
| 168 | const req = this._requirements.find(r => r.id === reqId); |
| 169 | if (!req) return { ok: false, advanced: false, next: null, message: `Requirement ${reqId} not found.` }; |
| 170 | |
| 171 | req.status = REQ_STATUS.DONE; |
| 172 | this._save(); |
| 173 | |
| 174 | const next = this._requirements.find(r => r.status === REQ_STATUS.PENDING); |
| 175 | if (next) { |
| 176 | next.status = REQ_STATUS.ACTIVE; |
| 177 | this._save(); |
| 178 | return { |
| 179 | ok: true, |
| 180 | advanced: true, |
| 181 | next, |
| 182 | message: `✓ "${req.text}" done. Moving to next: "${next.text}" (${next.id}).`, |
| 183 | }; |
| 184 | } |
| 185 | |
| 186 | const done = this.doneRequirements().length; |
| 187 | const total = this._requirements.length; |
| 188 | return { |
| 189 | ok: true, |
| 190 | advanced: false, |
| 191 | next: null, |
| 192 | message: `✓ All ${total} requirement(s) implemented. Run run_tests (full suite) to confirm no regressions, then the loop is complete.`, |
| 193 | }; |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Mark that a clean full-suite run was observed. Only meaningful after |
no test coverage detected