MCPcopy
hub / github.com/Doorman11991/smallcode / _save

Method _save

src/session/tdd_state.js:501–522  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

499 // ─── Persistence ───────────────────────────────────────────────────────────
500
501 _save() {
502 try {
503 const dir = path.dirname(this._stateFile);
504 if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
505 const state = {
506 phase: this._phase,
507 targetTest: this._targetTest,
508 redConfirmed: this._redConfirmed,
509 cycleId: this._cycleId,
510 startedAt: this._startedAt,
511 requirements: this._requirements,
512 loopActive: this._loopActive,
513 regressionClean: this._regressionClean,
514 updatedAt: new Date().toISOString(),
515 };
516 const tmp = this._stateFile + `.tmp.${process.pid}`;
517 fs.writeFileSync(tmp, JSON.stringify(state, null, 2), { mode: FILE_MODE });
518 fs.renameSync(tmp, this._stateFile);
519 } catch {
520 // Non-fatal
521 }
522 }
523
524 _load() {
525 try {

Callers 9

initRequirementsMethod · 0.95
_completeRequirementMethod · 0.95
markRegressionCleanMethod · 0.95
beginCycleMethod · 0.95
confirmRedMethod · 0.95
advanceToGreenMethod · 0.95
enterRefactorMethod · 0.95
resetMethod · 0.95
_finishCycleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected