MCPcopy Index your code
hub / github.com/Doorman11991/smallcode / checkToolCall

Method checkToolCall

src/session/tdd_state.js:406–424  ·  view source on GitHub ↗
(toolName, toolArgs)

Source from the content-addressed store, hash-verified

404 // ─── Guards ────────────────────────────────────────────────────────────────
405
406 checkToolCall(toolName, toolArgs) {
407 if (this.disabled || this._phase === PHASES.IDLE) return null;
408 const isWrite = toolName === 'write_file' || toolName === 'patch'
409 || toolName === 'append_file' || toolName === 'read_and_patch';
410 if (!isWrite) return null;
411
412 const filePath = toolArgs && (toolArgs.path || '');
413 const isTestFile = _isTestFile(filePath);
414
415 if (this._phase === PHASES.RED && !this._redConfirmed && !isTestFile) {
416 return `[TDD-GATE] RED phase — NOT YET confirmed red. Call run_tests (test_filter="${this._targetTest}") first to confirm this test fails. Do not write implementation yet.`;
417 }
418
419 if (this._phase === PHASES.GREEN && isTestFile) {
420 return `[TDD-GATE] GREEN phase — do NOT modify test files. Edit only implementation files. To change the test, call tdd_reset and start a new cycle.`;
421 }
422
423 return null;
424 }
425
426 // ─── Internal ──────────────────────────────────────────────────────────────
427

Callers

nothing calls this directly

Calls 1

_isTestFileFunction · 0.85

Tested by

no test coverage detected