xtrm-tools 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -111
- package/cli/dist/index.cjs +107 -53
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +1 -1
- package/config/pi/extensions/beads.ts +24 -0
- package/hooks/beads-gate-core.mjs +6 -4
- package/hooks/beads-memory-gate.mjs +12 -5
- package/hooks/hooks.json +126 -0
- package/package.json +3 -1
- package/skills/test-planning/SKILL.md +208 -0
- package/skills/test-planning/evals/evals.json +23 -0
- package/skills/using-xtrm/SKILL.md +5 -27
- package/project-skills/tdd-guard/.claude/hooks/tdd-guard-pretool-bridge.cjs +0 -103
- package/project-skills/tdd-guard/.claude/settings.json +0 -38
- package/project-skills/tdd-guard/.claude/skills/using-tdd-guard/SKILL.md +0 -79
- package/project-skills/tdd-guard/CLAUDE.md +0 -98
- package/project-skills/tdd-guard/CONTRIBUTING.md +0 -38
- package/project-skills/tdd-guard/DEVELOPMENT.md +0 -127
- package/project-skills/tdd-guard/LICENSE +0 -21
- package/project-skills/tdd-guard/README.md +0 -398
- package/project-skills/tdd-guard/docs/adr/001-claude-session-subdirectory.md +0 -52
- package/project-skills/tdd-guard/docs/adr/002-secure-claude-binary-path.md +0 -56
- package/project-skills/tdd-guard/docs/adr/003-remove-configurable-data-directory.md +0 -56
- package/project-skills/tdd-guard/docs/adr/004-monorepo-architecture.md +0 -64
- package/project-skills/tdd-guard/docs/adr/005-claude-project-dir-support.md +0 -55
- package/project-skills/tdd-guard/docs/adr/006-phpunit-separate-repository.md +0 -93
- package/project-skills/tdd-guard/docs/adr/007-golangci-lint-path-support.md +0 -83
- package/project-skills/tdd-guard/docs/adr/008-storybook-reporter-design.md +0 -182
- package/project-skills/tdd-guard/docs/assets/tdd-guard-demo-screenshot.gif +0 -0
- package/project-skills/tdd-guard/docs/config-migration.md +0 -143
- package/project-skills/tdd-guard/docs/configuration.md +0 -137
- package/project-skills/tdd-guard/docs/custom-instructions.md +0 -43
- package/project-skills/tdd-guard/docs/enforcement.md +0 -46
- package/project-skills/tdd-guard/docs/ignore-patterns.md +0 -81
- package/project-skills/tdd-guard/docs/linting.md +0 -109
- package/project-skills/tdd-guard/docs/quick-commands.md +0 -52
- package/project-skills/tdd-guard/docs/session-management.md +0 -75
- package/project-skills/tdd-guard/docs/storybook-vitest-addon.md +0 -120
- package/project-skills/tdd-guard/docs/validation-model.md +0 -63
- package/project-skills/tdd-guard/eslint.config.mjs +0 -140
- package/project-skills/tdd-guard/package-lock.json +0 -16937
- package/project-skills/tdd-guard/package.json +0 -102
- package/project-skills/tdd-guard/reporters/go/README.md +0 -67
- package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main.go +0 -127
- package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main_test.go +0 -280
- package/project-skills/tdd-guard/reporters/go/go.mod +0 -3
- package/project-skills/tdd-guard/reporters/go/go.sum +0 -0
- package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter.go +0 -126
- package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter_test.go +0 -264
- package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader.go +0 -26
- package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader_test.go +0 -37
- package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader.go +0 -94
- package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader_test.go +0 -198
- package/project-skills/tdd-guard/reporters/go/internal/parser/parser.go +0 -245
- package/project-skills/tdd-guard/reporters/go/internal/parser/parser_test.go +0 -547
- package/project-skills/tdd-guard/reporters/go/internal/storage/storage.go +0 -35
- package/project-skills/tdd-guard/reporters/go/internal/storage/storage_test.go +0 -113
- package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer.go +0 -103
- package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer_test.go +0 -303
- package/project-skills/tdd-guard/reporters/jest/README.md +0 -102
- package/project-skills/tdd-guard/reporters/jest/package.json +0 -38
- package/project-skills/tdd-guard/reporters/jest/src/JestReporter.test-data.ts +0 -199
- package/project-skills/tdd-guard/reporters/jest/src/JestReporter.test.ts +0 -302
- package/project-skills/tdd-guard/reporters/jest/src/JestReporter.ts +0 -201
- package/project-skills/tdd-guard/reporters/jest/src/index.ts +0 -4
- package/project-skills/tdd-guard/reporters/jest/src/types.ts +0 -42
- package/project-skills/tdd-guard/reporters/jest/tsconfig.json +0 -11
- package/project-skills/tdd-guard/reporters/phpunit/.php-cs-fixer.php +0 -28
- package/project-skills/tdd-guard/reporters/phpunit/README.md +0 -97
- package/project-skills/tdd-guard/reporters/phpunit/SYNC_README.md +0 -29
- package/project-skills/tdd-guard/reporters/phpunit/composer.json +0 -55
- package/project-skills/tdd-guard/reporters/phpunit/phpunit.xml.dist +0 -19
- package/project-skills/tdd-guard/reporters/phpunit/psalm.xml +0 -44
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/ErroredTestSubscriber.php +0 -28
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/FailedTestSubscriber.php +0 -28
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/IncompleteTestSubscriber.php +0 -28
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/PassedTestSubscriber.php +0 -27
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/SkippedTestSubscriber.php +0 -28
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/TestRunnerFinishedSubscriber.php +0 -24
- package/project-skills/tdd-guard/reporters/phpunit/src/PathValidator.php +0 -88
- package/project-skills/tdd-guard/reporters/phpunit/src/Storage.php +0 -26
- package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardExtension.php +0 -33
- package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardListener.php +0 -158
- package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardSubscriber.php +0 -35
- package/project-skills/tdd-guard/reporters/phpunit/src/TestResultCollector.php +0 -105
- package/project-skills/tdd-guard/reporters/phpunit/tests/PathValidatorTest.php +0 -74
- package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionFailedTest.php +0 -241
- package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionTest.php +0 -84
- package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardStorageLocationTest.php +0 -71
- package/project-skills/tdd-guard/reporters/pytest/README.md +0 -77
- package/project-skills/tdd-guard/reporters/pytest/pyproject.toml +0 -43
- package/project-skills/tdd-guard/reporters/pytest/pytest.ini.example +0 -7
- package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/__init__.py +0 -1
- package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/pytest_reporter.py +0 -134
- package/project-skills/tdd-guard/reporters/pytest/tests/__init__.py +0 -1
- package/project-skills/tdd-guard/reporters/pytest/tests/conftest.py +0 -3
- package/project-skills/tdd-guard/reporters/pytest/tests/helpers.py +0 -293
- package/project-skills/tdd-guard/reporters/pytest/tests/test_config_option.py +0 -38
- package/project-skills/tdd-guard/reporters/pytest/tests/test_path_validation.py +0 -59
- package/project-skills/tdd-guard/reporters/pytest/tests/test_plugin_config.py +0 -32
- package/project-skills/tdd-guard/reporters/pytest/tests/test_project_root.py +0 -296
- package/project-skills/tdd-guard/reporters/pytest/tests/test_pytest_reporter.py +0 -137
- package/project-skills/tdd-guard/reporters/rspec/Gemfile +0 -3
- package/project-skills/tdd-guard/reporters/rust/Cargo.lock +0 -458
- package/project-skills/tdd-guard/reporters/rust/Cargo.toml +0 -33
- package/project-skills/tdd-guard/reporters/rust/Makefile.example +0 -95
- package/project-skills/tdd-guard/reporters/rust/README.md +0 -88
- package/project-skills/tdd-guard/reporters/rust/src/error_parser.rs +0 -309
- package/project-skills/tdd-guard/reporters/rust/src/main.rs +0 -464
- package/project-skills/tdd-guard/reporters/rust/src/parser.rs +0 -225
- package/project-skills/tdd-guard/reporters/rust/src/transformer.rs +0 -409
- package/project-skills/tdd-guard/reporters/storybook/README.md +0 -108
- package/project-skills/tdd-guard/reporters/storybook/package-lock.json +0 -9482
- package/project-skills/tdd-guard/reporters/storybook/package.json +0 -43
- package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test-data.ts +0 -22
- package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test.ts +0 -190
- package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.ts +0 -88
- package/project-skills/tdd-guard/reporters/storybook/src/index.ts +0 -12
- package/project-skills/tdd-guard/reporters/storybook/src/types.ts +0 -37
- package/project-skills/tdd-guard/reporters/storybook/tsconfig.json +0 -11
- package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/go.mod +0 -3
- package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/single_failing_test.go +0 -13
- package/project-skills/tdd-guard/reporters/test/artifacts/go/import/go.mod +0 -3
- package/project-skills/tdd-guard/reporters/test/artifacts/go/import/single_import_error_test.go +0 -17
- package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/go.mod +0 -3
- package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/single_passing_test.go +0 -13
- package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-failing.test.js +0 -5
- package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-import-error.test.js +0 -8
- package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-passing.test.js +0 -5
- package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleFailingTest.php +0 -11
- package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleImportErrorTest.php +0 -14
- package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SinglePassingTest.php +0 -11
- package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_failing.py +0 -3
- package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_import_error.py +0 -6
- package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_passing.py +0 -3
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.lock +0 -7
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.toml +0 -4
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/src/lib.rs +0 -14
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.lock +0 -7
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.toml +0 -4
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/src/lib.rs +0 -13
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.lock +0 -7
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.toml +0 -4
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/src/lib.rs +0 -14
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/Calculator.js +0 -4
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-failing.stories.js +0 -15
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-import-error.stories.js +0 -14
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-passing.stories.js +0 -15
- package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-failing.test.js +0 -7
- package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-import-error.test.js +0 -9
- package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-passing.test.js +0 -7
- package/project-skills/tdd-guard/reporters/test/factories/go.ts +0 -59
- package/project-skills/tdd-guard/reporters/test/factories/helpers.ts +0 -48
- package/project-skills/tdd-guard/reporters/test/factories/index.ts +0 -7
- package/project-skills/tdd-guard/reporters/test/factories/jest.ts +0 -51
- package/project-skills/tdd-guard/reporters/test/factories/phpunit.ts +0 -63
- package/project-skills/tdd-guard/reporters/test/factories/pytest.ts +0 -41
- package/project-skills/tdd-guard/reporters/test/factories/rust.ts +0 -158
- package/project-skills/tdd-guard/reporters/test/factories/storybook.ts +0 -198
- package/project-skills/tdd-guard/reporters/test/factories/vitest.ts +0 -51
- package/project-skills/tdd-guard/reporters/test/reporters.integration.test.ts +0 -735
- package/project-skills/tdd-guard/reporters/test/types.ts +0 -28
- package/project-skills/tdd-guard/reporters/vitest/README.md +0 -64
- package/project-skills/tdd-guard/reporters/vitest/package.json +0 -35
- package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.test-data.ts +0 -85
- package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.test.ts +0 -446
- package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.ts +0 -110
- package/project-skills/tdd-guard/reporters/vitest/src/index.ts +0 -4
- package/project-skills/tdd-guard/reporters/vitest/src/types.ts +0 -39
- package/project-skills/tdd-guard/reporters/vitest/tsconfig.json +0 -11
- package/project-skills/tdd-guard/src/cli/buildContext.test.ts +0 -200
- package/project-skills/tdd-guard/src/cli/buildContext.ts +0 -48
- package/project-skills/tdd-guard/src/cli/tdd-guard.test.ts +0 -159
- package/project-skills/tdd-guard/src/cli/tdd-guard.ts +0 -48
- package/project-skills/tdd-guard/src/config/Config.test.ts +0 -538
- package/project-skills/tdd-guard/src/config/Config.ts +0 -172
- package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.test.ts +0 -58
- package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.ts +0 -8
- package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.test.ts +0 -347
- package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.ts +0 -61
- package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.test.ts +0 -24
- package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.ts +0 -7
- package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.test.ts +0 -377
- package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.ts +0 -75
- package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.test.ts +0 -563
- package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.ts +0 -140
- package/project-skills/tdd-guard/src/contracts/types/ClientType.ts +0 -1
- package/project-skills/tdd-guard/src/contracts/types/ConfigOptions.ts +0 -12
- package/project-skills/tdd-guard/src/contracts/types/Context.ts +0 -16
- package/project-skills/tdd-guard/src/contracts/types/ModelClient.ts +0 -3
- package/project-skills/tdd-guard/src/contracts/types/ValidationResult.ts +0 -6
- package/project-skills/tdd-guard/src/guard/GuardManager.test.ts +0 -336
- package/project-skills/tdd-guard/src/guard/GuardManager.ts +0 -83
- package/project-skills/tdd-guard/src/hooks/HookEvents.test.ts +0 -107
- package/project-skills/tdd-guard/src/hooks/HookEvents.ts +0 -39
- package/project-skills/tdd-guard/src/hooks/fileTypeDetection.ts +0 -16
- package/project-skills/tdd-guard/src/hooks/postToolLint.test.ts +0 -327
- package/project-skills/tdd-guard/src/hooks/postToolLint.ts +0 -165
- package/project-skills/tdd-guard/src/hooks/processHookData.test.ts +0 -465
- package/project-skills/tdd-guard/src/hooks/processHookData.ts +0 -203
- package/project-skills/tdd-guard/src/hooks/sessionHandler.test.ts +0 -136
- package/project-skills/tdd-guard/src/hooks/sessionHandler.ts +0 -31
- package/project-skills/tdd-guard/src/hooks/userPromptHandler.test.ts +0 -131
- package/project-skills/tdd-guard/src/hooks/userPromptHandler.ts +0 -55
- package/project-skills/tdd-guard/src/index.ts +0 -19
- package/project-skills/tdd-guard/src/linters/Linter.ts +0 -5
- package/project-skills/tdd-guard/src/linters/eslint/ESLint.test.ts +0 -183
- package/project-skills/tdd-guard/src/linters/eslint/ESLint.ts +0 -82
- package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.test.ts +0 -170
- package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.ts +0 -148
- package/project-skills/tdd-guard/src/processors/index.ts +0 -1
- package/project-skills/tdd-guard/src/processors/lintProcessor.ts +0 -77
- package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.test.ts +0 -303
- package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.ts +0 -255
- package/project-skills/tdd-guard/src/providers/LinterProvider.test.ts +0 -43
- package/project-skills/tdd-guard/src/providers/LinterProvider.ts +0 -20
- package/project-skills/tdd-guard/src/providers/ModelClientProvider.test.ts +0 -68
- package/project-skills/tdd-guard/src/providers/ModelClientProvider.ts +0 -22
- package/project-skills/tdd-guard/src/storage/FileStorage.test.ts +0 -76
- package/project-skills/tdd-guard/src/storage/FileStorage.ts +0 -108
- package/project-skills/tdd-guard/src/storage/MemoryStorage.ts +0 -57
- package/project-skills/tdd-guard/src/storage/Storage.test.ts +0 -227
- package/project-skills/tdd-guard/src/storage/Storage.ts +0 -17
- package/project-skills/tdd-guard/src/validation/context/context.test.ts +0 -364
- package/project-skills/tdd-guard/src/validation/context/context.ts +0 -155
- package/project-skills/tdd-guard/src/validation/models/AnthropicApi.test.ts +0 -171
- package/project-skills/tdd-guard/src/validation/models/AnthropicApi.ts +0 -49
- package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.test.ts +0 -167
- package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.ts +0 -54
- package/project-skills/tdd-guard/src/validation/models/ClaudeCli.test.ts +0 -239
- package/project-skills/tdd-guard/src/validation/models/ClaudeCli.ts +0 -57
- package/project-skills/tdd-guard/src/validation/prompts/file-types.ts +0 -52
- package/project-skills/tdd-guard/src/validation/prompts/operations/edit.ts +0 -58
- package/project-skills/tdd-guard/src/validation/prompts/operations/multi-edit.ts +0 -54
- package/project-skills/tdd-guard/src/validation/prompts/operations/write.ts +0 -54
- package/project-skills/tdd-guard/src/validation/prompts/response.ts +0 -40
- package/project-skills/tdd-guard/src/validation/prompts/rules.ts +0 -51
- package/project-skills/tdd-guard/src/validation/prompts/system-prompt.ts +0 -10
- package/project-skills/tdd-guard/src/validation/prompts/tools/lint-results.ts +0 -15
- package/project-skills/tdd-guard/src/validation/prompts/tools/test-output.ts +0 -14
- package/project-skills/tdd-guard/src/validation/prompts/tools/todos.ts +0 -9
- package/project-skills/tdd-guard/src/validation/validator.test.ts +0 -268
- package/project-skills/tdd-guard/src/validation/validator.ts +0 -159
- package/project-skills/tdd-guard/test/artifacts/go/.golangci.yml +0 -6
- package/project-skills/tdd-guard/test/artifacts/go/with-issues/file-with-issues.go +0 -12
- package/project-skills/tdd-guard/test/artifacts/go/with-issues/go.mod +0 -3
- package/project-skills/tdd-guard/test/artifacts/go/without-issues/file-without-issues.go +0 -7
- package/project-skills/tdd-guard/test/artifacts/go/without-issues/go.mod +0 -3
- package/project-skills/tdd-guard/test/artifacts/javascript/eslint.config.js +0 -20
- package/project-skills/tdd-guard/test/artifacts/javascript/file-with-issues.js +0 -12
- package/project-skills/tdd-guard/test/artifacts/javascript/file-without-issues.js +0 -10
- package/project-skills/tdd-guard/test/hooks/fileTypeDetection.test.ts +0 -26
- package/project-skills/tdd-guard/test/hooks/processHookData.fileType.test.ts +0 -46
- package/project-skills/tdd-guard/test/hooks/processHookData.python.test.ts +0 -68
- package/project-skills/tdd-guard/test/integration/test-context.test.ts +0 -66
- package/project-skills/tdd-guard/test/integration/validator.core.test.ts +0 -96
- package/project-skills/tdd-guard/test/integration/validator.scenarios.test.ts +0 -497
- package/project-skills/tdd-guard/test/utils/assertions.ts +0 -29
- package/project-skills/tdd-guard/test/utils/factories/contextFactory.ts +0 -30
- package/project-skills/tdd-guard/test/utils/factories/editFactory.ts +0 -82
- package/project-skills/tdd-guard/test/utils/factories/helpers.test.ts +0 -46
- package/project-skills/tdd-guard/test/utils/factories/helpers.ts +0 -46
- package/project-skills/tdd-guard/test/utils/factories/lintFactory.ts +0 -352
- package/project-skills/tdd-guard/test/utils/factories/modelClientProviderFactory.ts +0 -21
- package/project-skills/tdd-guard/test/utils/factories/multiEditFactory.ts +0 -79
- package/project-skills/tdd-guard/test/utils/factories/operations.ts +0 -57
- package/project-skills/tdd-guard/test/utils/factories/reporterFactory.ts +0 -55
- package/project-skills/tdd-guard/test/utils/factories/scenarios/index.ts +0 -22
- package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/python.ts +0 -745
- package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/typescript.ts +0 -767
- package/project-skills/tdd-guard/test/utils/factories/scenarios/types.ts +0 -77
- package/project-skills/tdd-guard/test/utils/factories/scenarios/utils.ts +0 -15
- package/project-skills/tdd-guard/test/utils/factories/sessionStartFactory.ts +0 -36
- package/project-skills/tdd-guard/test/utils/factories/testDefaults.ts +0 -90
- package/project-skills/tdd-guard/test/utils/factories/testResultsFactory.ts +0 -234
- package/project-skills/tdd-guard/test/utils/factories/todoFactory.ts +0 -99
- package/project-skills/tdd-guard/test/utils/factories/userPromptSubmitFactory.ts +0 -39
- package/project-skills/tdd-guard/test/utils/factories/writeFactory.ts +0 -70
- package/project-skills/tdd-guard/test/utils/index.ts +0 -131
- package/project-skills/tdd-guard/tsconfig.build.json +0 -16
- package/project-skills/tdd-guard/tsconfig.eslint.json +0 -17
- package/project-skills/tdd-guard/tsconfig.json +0 -32
- package/project-skills/tdd-guard/tsconfig.node.json +0 -10
- package/project-skills/tdd-guard/vitest.config.ts +0 -85
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
|
-
import { Storage } from './Storage'
|
|
3
|
-
import { MemoryStorage } from './MemoryStorage'
|
|
4
|
-
import { FileStorage } from './FileStorage'
|
|
5
|
-
import { Config } from '../config/Config'
|
|
6
|
-
import fs from 'fs/promises'
|
|
7
|
-
import path from 'path'
|
|
8
|
-
import os from 'os'
|
|
9
|
-
|
|
10
|
-
// Test content constants
|
|
11
|
-
const FIRST_CONTENT = 'first content'
|
|
12
|
-
const SECOND_CONTENT = 'second content'
|
|
13
|
-
|
|
14
|
-
describe.each(getStorageImplementations())('%s', (_name, setupStorage) => {
|
|
15
|
-
let storage: Storage
|
|
16
|
-
let cleanup: (() => Promise<void>) | undefined
|
|
17
|
-
|
|
18
|
-
beforeEach(async () => {
|
|
19
|
-
const setup = await setupStorage()
|
|
20
|
-
storage = setup.storage
|
|
21
|
-
cleanup = setup.cleanup
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
afterEach(async () => {
|
|
25
|
-
if (cleanup) {
|
|
26
|
-
await cleanup()
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
describe('saveTest and getTest', () => {
|
|
31
|
-
it('should store content that can be retrieved', async () => {
|
|
32
|
-
const content = 'test content'
|
|
33
|
-
|
|
34
|
-
await storage.saveTest(content)
|
|
35
|
-
expect(await storage.getTest()).toBe(content)
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
describe('saveTodo and getTodo', () => {
|
|
40
|
-
it('should store content that can be retrieved', async () => {
|
|
41
|
-
const content = 'todo content'
|
|
42
|
-
|
|
43
|
-
await storage.saveTodo(content)
|
|
44
|
-
expect(await storage.getTodo()).toBe(content)
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
describe('saveModifications and getModifications', () => {
|
|
49
|
-
it('should store content that can be retrieved', async () => {
|
|
50
|
-
const content = 'modifications content'
|
|
51
|
-
|
|
52
|
-
await storage.saveModifications(content)
|
|
53
|
-
expect(await storage.getModifications()).toBe(content)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
describe('saveLint and getLint', () => {
|
|
58
|
-
it('should store content that can be retrieved', async () => {
|
|
59
|
-
const content = 'lint content'
|
|
60
|
-
|
|
61
|
-
await storage.saveLint(content)
|
|
62
|
-
expect(await storage.getLint()).toBe(content)
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
describe('saveConfig and getConfig', () => {
|
|
67
|
-
it('should store content that can be retrieved', async () => {
|
|
68
|
-
const content = 'config content'
|
|
69
|
-
|
|
70
|
-
await storage.saveConfig(content)
|
|
71
|
-
expect(await storage.getConfig()).toBe(content)
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
describe('saveInstructions and getInstructions', () => {
|
|
76
|
-
it('should store content that can be retrieved', async () => {
|
|
77
|
-
const content = 'instructions content'
|
|
78
|
-
|
|
79
|
-
await storage.saveInstructions(content)
|
|
80
|
-
expect(await storage.getInstructions()).toBe(content)
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
describe('get methods when no data exists', () => {
|
|
85
|
-
it('should return null when no test data exists', async () => {
|
|
86
|
-
expect(await storage.getTest()).toBeNull()
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('should return null when no todo data exists', async () => {
|
|
90
|
-
expect(await storage.getTodo()).toBeNull()
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('should return null when no modifications data exists', async () => {
|
|
94
|
-
expect(await storage.getModifications()).toBeNull()
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('should return null when no lint data exists', async () => {
|
|
98
|
-
expect(await storage.getLint()).toBeNull()
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it('should return null when no config data exists', async () => {
|
|
102
|
-
expect(await storage.getConfig()).toBeNull()
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('should return null when no instructions exist', async () => {
|
|
106
|
-
expect(await storage.getInstructions()).toBeNull()
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
describe('save methods overwrite existing content', () => {
|
|
111
|
-
beforeEach(async () => {
|
|
112
|
-
await storage.saveTest(FIRST_CONTENT)
|
|
113
|
-
await storage.saveTodo(FIRST_CONTENT)
|
|
114
|
-
await storage.saveModifications(FIRST_CONTENT)
|
|
115
|
-
await storage.saveLint(FIRST_CONTENT)
|
|
116
|
-
await storage.saveConfig(FIRST_CONTENT)
|
|
117
|
-
await storage.saveInstructions(FIRST_CONTENT)
|
|
118
|
-
await storage.saveTest(SECOND_CONTENT)
|
|
119
|
-
await storage.saveTodo(SECOND_CONTENT)
|
|
120
|
-
await storage.saveModifications(SECOND_CONTENT)
|
|
121
|
-
await storage.saveLint(SECOND_CONTENT)
|
|
122
|
-
await storage.saveConfig(SECOND_CONTENT)
|
|
123
|
-
await storage.saveInstructions(SECOND_CONTENT)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('should overwrite existing test content', async () => {
|
|
127
|
-
expect(await storage.getTest()).toBe(SECOND_CONTENT)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
it('should overwrite existing todo content', async () => {
|
|
131
|
-
expect(await storage.getTodo()).toBe(SECOND_CONTENT)
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
it('should overwrite existing modifications content', async () => {
|
|
135
|
-
expect(await storage.getModifications()).toBe(SECOND_CONTENT)
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
it('should overwrite existing lint content', async () => {
|
|
139
|
-
expect(await storage.getLint()).toBe(SECOND_CONTENT)
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('should overwrite existing config content', async () => {
|
|
143
|
-
expect(await storage.getConfig()).toBe(SECOND_CONTENT)
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('should overwrite existing instructions content', async () => {
|
|
147
|
-
expect(await storage.getInstructions()).toBe(SECOND_CONTENT)
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
describe('clearTransientData', () => {
|
|
152
|
-
it('should clear test data', async () => {
|
|
153
|
-
await storage.saveTest('test content')
|
|
154
|
-
await storage.clearTransientData()
|
|
155
|
-
|
|
156
|
-
expect(await storage.getTest()).toBeNull()
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
it('should clear todo data', async () => {
|
|
160
|
-
await storage.saveTodo('todo content')
|
|
161
|
-
await storage.clearTransientData()
|
|
162
|
-
|
|
163
|
-
expect(await storage.getTodo()).toBeNull()
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
it('should clear modifications data', async () => {
|
|
167
|
-
await storage.saveModifications('modifications content')
|
|
168
|
-
await storage.clearTransientData()
|
|
169
|
-
|
|
170
|
-
expect(await storage.getModifications()).toBeNull()
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
it('should clear lint data', async () => {
|
|
174
|
-
await storage.saveLint('lint content')
|
|
175
|
-
await storage.clearTransientData()
|
|
176
|
-
|
|
177
|
-
expect(await storage.getLint()).toBeNull()
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
it('should NOT clear config data', async () => {
|
|
181
|
-
await storage.saveConfig('config content')
|
|
182
|
-
await storage.clearTransientData()
|
|
183
|
-
|
|
184
|
-
expect(await storage.getConfig()).toBe('config content')
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
it('should NOT clear instructions data', async () => {
|
|
188
|
-
await storage.saveInstructions('instructions content')
|
|
189
|
-
await storage.clearTransientData()
|
|
190
|
-
|
|
191
|
-
expect(await storage.getInstructions()).toBe('instructions content')
|
|
192
|
-
})
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
function getStorageImplementations(): Array<
|
|
197
|
-
[string, () => Promise<{ storage: Storage; cleanup?: () => Promise<void> }>]
|
|
198
|
-
> {
|
|
199
|
-
return [
|
|
200
|
-
[
|
|
201
|
-
'MemoryStorage',
|
|
202
|
-
async (): Promise<{
|
|
203
|
-
storage: Storage
|
|
204
|
-
cleanup?: () => Promise<void>
|
|
205
|
-
}> => ({
|
|
206
|
-
storage: new MemoryStorage(),
|
|
207
|
-
}),
|
|
208
|
-
],
|
|
209
|
-
[
|
|
210
|
-
'FileStorage',
|
|
211
|
-
async (): Promise<{
|
|
212
|
-
storage: Storage
|
|
213
|
-
cleanup?: () => Promise<void>
|
|
214
|
-
}> => {
|
|
215
|
-
const projectRoot = await fs.mkdtemp(
|
|
216
|
-
path.join(os.tmpdir(), 'storage-test-')
|
|
217
|
-
)
|
|
218
|
-
return {
|
|
219
|
-
storage: new FileStorage(new Config({ projectRoot })),
|
|
220
|
-
cleanup: async (): Promise<void> => {
|
|
221
|
-
await fs.rm(projectRoot, { recursive: true, force: true })
|
|
222
|
-
},
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
],
|
|
226
|
-
]
|
|
227
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const TRANSIENT_DATA = ['test', 'todo', 'modifications', 'lint'] as const
|
|
2
|
-
|
|
3
|
-
export interface Storage {
|
|
4
|
-
saveTest(content: string): Promise<void>
|
|
5
|
-
saveTodo(content: string): Promise<void>
|
|
6
|
-
saveModifications(content: string): Promise<void>
|
|
7
|
-
saveLint(content: string): Promise<void>
|
|
8
|
-
saveConfig(content: string): Promise<void>
|
|
9
|
-
saveInstructions(content: string): Promise<void>
|
|
10
|
-
getTest(): Promise<string | null>
|
|
11
|
-
getTodo(): Promise<string | null>
|
|
12
|
-
getModifications(): Promise<string | null>
|
|
13
|
-
getLint(): Promise<string | null>
|
|
14
|
-
getConfig(): Promise<string | null>
|
|
15
|
-
getInstructions(): Promise<string | null>
|
|
16
|
-
clearTransientData(): Promise<void>
|
|
17
|
-
}
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect, beforeEach } from 'vitest'
|
|
2
|
-
import { testData } from '@testUtils'
|
|
3
|
-
import { generateDynamicContext } from './context'
|
|
4
|
-
import { ToolOperation } from '../../contracts/schemas/toolSchemas'
|
|
5
|
-
import { SYSTEM_PROMPT } from '../prompts/system-prompt'
|
|
6
|
-
import { RULES } from '../prompts/rules'
|
|
7
|
-
import { FILE_TYPES } from '../prompts/file-types'
|
|
8
|
-
import { RESPONSE } from '../prompts/response'
|
|
9
|
-
import { EDIT } from '../prompts/operations/edit'
|
|
10
|
-
import { MULTI_EDIT } from '../prompts/operations/multi-edit'
|
|
11
|
-
import { WRITE } from '../prompts/operations/write'
|
|
12
|
-
import { TODOS } from '../prompts/tools/todos'
|
|
13
|
-
import { TEST_OUTPUT } from '../prompts/tools/test-output'
|
|
14
|
-
import { Config } from '../../config/Config'
|
|
15
|
-
|
|
16
|
-
describe('generateDynamicContext', () => {
|
|
17
|
-
test('uses default Config when config parameter is omitted', () => {
|
|
18
|
-
const editOperation = testData.editOperation()
|
|
19
|
-
const context = {
|
|
20
|
-
modifications: JSON.stringify(editOperation),
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Call without config parameter
|
|
24
|
-
const result = generateDynamicContext(context)
|
|
25
|
-
|
|
26
|
-
// Should return valid result
|
|
27
|
-
expect(result).toContain('## TDD Fundamentals')
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
describe('when Edit operation', () => {
|
|
31
|
-
let editOperation: ReturnType<typeof testData.editOperation>
|
|
32
|
-
let result: string
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
editOperation = testData.editOperation()
|
|
36
|
-
result = generateContextResult(editOperation)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
test('should include core prompts', () => {
|
|
40
|
-
expectCorePrompts(result)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
test('should include Edit operation context', () => {
|
|
44
|
-
expect(EDIT.length).toBeGreaterThan(0)
|
|
45
|
-
expect(result).toContain(EDIT)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
test('should format file path section', () => {
|
|
49
|
-
expect(result).toContain('### File Path')
|
|
50
|
-
expect(result).toContain(editOperation.tool_input.file_path)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
test('should format old content section', () => {
|
|
54
|
-
expect(result).toContain('### Old Content')
|
|
55
|
-
expect(result).toContain(editOperation.tool_input.old_string)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
test('should format new content section', () => {
|
|
59
|
-
expect(result).toContain('### New Content')
|
|
60
|
-
expect(result).toContain(editOperation.tool_input.new_string)
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
describe('when MultiEdit operation', () => {
|
|
65
|
-
let multiEditOperation: ReturnType<typeof testData.multiEditOperation>
|
|
66
|
-
let result: string
|
|
67
|
-
|
|
68
|
-
beforeEach(() => {
|
|
69
|
-
multiEditOperation = testData.multiEditOperation()
|
|
70
|
-
result = generateContextResult(multiEditOperation)
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
test('should include core prompts', () => {
|
|
74
|
-
expectCorePrompts(result)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
test('should include MultiEdit operation context', () => {
|
|
78
|
-
expect(MULTI_EDIT.length).toBeGreaterThan(0)
|
|
79
|
-
expect(result).toContain(MULTI_EDIT)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
test('should format file path section', () => {
|
|
83
|
-
expect(result).toContain('### File Path')
|
|
84
|
-
expect(result).toContain(multiEditOperation.tool_input.file_path)
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
test('should format edits section', () => {
|
|
88
|
-
expect(result).toContain('### Edits')
|
|
89
|
-
expect(result).toContain('#### Edit 1:')
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
test('should format first edit with old and new content', () => {
|
|
93
|
-
expect(result).toContain('**Old Content:**')
|
|
94
|
-
expect(result).toContain(
|
|
95
|
-
multiEditOperation.tool_input.edits[0].old_string
|
|
96
|
-
)
|
|
97
|
-
expect(result).toContain('**New Content:**')
|
|
98
|
-
expect(result).toContain(
|
|
99
|
-
multiEditOperation.tool_input.edits[0].new_string
|
|
100
|
-
)
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
describe('when Write operation', () => {
|
|
105
|
-
let writeOperation: ReturnType<typeof testData.writeOperation>
|
|
106
|
-
let result: string
|
|
107
|
-
|
|
108
|
-
beforeEach(() => {
|
|
109
|
-
writeOperation = testData.writeOperation()
|
|
110
|
-
result = generateContextResult(writeOperation)
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
test('should include core prompts', () => {
|
|
114
|
-
expectCorePrompts(result)
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
test('should include Write operation context', () => {
|
|
118
|
-
expect(WRITE.length).toBeGreaterThan(0)
|
|
119
|
-
expect(result).toContain(WRITE)
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
test('should format file path section', () => {
|
|
123
|
-
expect(result).toContain('### File Path')
|
|
124
|
-
expect(result).toContain(writeOperation.tool_input.file_path)
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
test('should format new file content section', () => {
|
|
128
|
-
expect(result).toContain('### New File Content')
|
|
129
|
-
expect(result).toContain(writeOperation.tool_input.content)
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
describe('when test output is provided', () => {
|
|
134
|
-
let editOperation: ReturnType<typeof testData.editOperation>
|
|
135
|
-
let testResults: ReturnType<typeof testData.failedTestResults>
|
|
136
|
-
let result: string
|
|
137
|
-
|
|
138
|
-
beforeEach(() => {
|
|
139
|
-
editOperation = testData.editOperation()
|
|
140
|
-
testResults = testData.failedTestResults()
|
|
141
|
-
result = generateContextResult(editOperation, {
|
|
142
|
-
test: JSON.stringify(testResults),
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
test('should include test output context', () => {
|
|
147
|
-
expect(TEST_OUTPUT.length).toBeGreaterThan(0)
|
|
148
|
-
expect(result).toContain(TEST_OUTPUT)
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
test('should format test output using TestResultsProcessor', () => {
|
|
152
|
-
expect(result).toContain(' ❯ /src/example.test.ts (1 tests | 1 failed)')
|
|
153
|
-
expect(result).toContain(' × Calculator > should calculate sum')
|
|
154
|
-
expect(result).toContain(' → expected 5 to be 6')
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
test('should include test summary', () => {
|
|
158
|
-
expect(result).toContain(' Test Files 1 failed (1)')
|
|
159
|
-
expect(result).toContain(' Tests 1 failed (1)')
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
test('should not contain raw JSON', () => {
|
|
163
|
-
expect(result).not.toContain('"testModules"')
|
|
164
|
-
expect(result).not.toContain('"moduleId"')
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
describe('when todo is provided', () => {
|
|
169
|
-
let editOperation: ReturnType<typeof testData.editOperation>
|
|
170
|
-
let todoWriteOperation: ReturnType<typeof testData.todoWriteOperation>
|
|
171
|
-
let result: string
|
|
172
|
-
|
|
173
|
-
beforeEach(() => {
|
|
174
|
-
editOperation = testData.editOperation()
|
|
175
|
-
todoWriteOperation = testData.todoWriteOperation()
|
|
176
|
-
result = generateContextResult(editOperation, {
|
|
177
|
-
todo: JSON.stringify(todoWriteOperation),
|
|
178
|
-
})
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
test('should include todo context', () => {
|
|
182
|
-
expect(TODOS.length).toBeGreaterThan(0)
|
|
183
|
-
expect(result).toContain(TODOS)
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
test('should format todo items', () => {
|
|
187
|
-
expect(result).toContain('[pending] Implement feature (high)')
|
|
188
|
-
})
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
describe('when todo is not provided', () => {
|
|
192
|
-
let result: string
|
|
193
|
-
|
|
194
|
-
beforeEach(() => {
|
|
195
|
-
const editOperation = testData.editOperation()
|
|
196
|
-
result = generateContextResult(editOperation)
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
test('should not include todo context', () => {
|
|
200
|
-
expect(result).not.toContain(TODOS)
|
|
201
|
-
})
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
describe('prompt ordering', () => {
|
|
205
|
-
test('should assemble prompts in correct order', () => {
|
|
206
|
-
const editOperation = testData.editOperation()
|
|
207
|
-
const result = generateContextResult(editOperation)
|
|
208
|
-
|
|
209
|
-
// Verify order by checking indexOf
|
|
210
|
-
const systemIndex = result.indexOf('# TDD-Guard')
|
|
211
|
-
const rulesIndex = result.indexOf('## TDD Fundamentals')
|
|
212
|
-
const fileRulesIndex = result.indexOf('## File Type Specific Rules')
|
|
213
|
-
const operationIndex = result.indexOf('## Analyzing Edit Operations')
|
|
214
|
-
const changesIndex = result.indexOf('### File Path')
|
|
215
|
-
const responseIndex = result.indexOf('## Your Response')
|
|
216
|
-
|
|
217
|
-
expect(systemIndex).toBeLessThan(rulesIndex)
|
|
218
|
-
expect(rulesIndex).toBeLessThan(fileRulesIndex)
|
|
219
|
-
expect(fileRulesIndex).toBeLessThan(operationIndex)
|
|
220
|
-
expect(operationIndex).toBeLessThan(changesIndex)
|
|
221
|
-
expect(changesIndex).toBeLessThan(responseIndex)
|
|
222
|
-
})
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
describe('system prompt', () => {
|
|
226
|
-
test.each([
|
|
227
|
-
['cli', true],
|
|
228
|
-
['sdk', false],
|
|
229
|
-
['api', false],
|
|
230
|
-
] as const)(
|
|
231
|
-
'%s client includes system prompt: %s',
|
|
232
|
-
(client, shouldInclude) => {
|
|
233
|
-
const config = new Config({ validationClient: client })
|
|
234
|
-
const editOperation = testData.editOperation()
|
|
235
|
-
const context = {
|
|
236
|
-
modifications: JSON.stringify(editOperation),
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const result = generateDynamicContext(context, config)
|
|
240
|
-
|
|
241
|
-
const containsSystemPrompt = result.includes(SYSTEM_PROMPT)
|
|
242
|
-
expect(containsSystemPrompt).toBe(shouldInclude)
|
|
243
|
-
}
|
|
244
|
-
)
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
describe('custom instructions', () => {
|
|
248
|
-
const customInstructions =
|
|
249
|
-
'## Custom TDD Rules\n1. Always test first\n2. Keep it simple'
|
|
250
|
-
|
|
251
|
-
describe('when custom instructions provided', () => {
|
|
252
|
-
let result: string
|
|
253
|
-
|
|
254
|
-
beforeEach(() => {
|
|
255
|
-
result = generateContextResult(testData.editOperation(), {
|
|
256
|
-
instructions: customInstructions,
|
|
257
|
-
})
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
test('should use custom instructions', () => {
|
|
261
|
-
expect(result).toContain(customInstructions)
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
test('should not include default rules', () => {
|
|
265
|
-
expect(result).not.toContain(RULES)
|
|
266
|
-
})
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
describe('when custom instructions not provided', () => {
|
|
270
|
-
let result: string
|
|
271
|
-
|
|
272
|
-
beforeEach(() => {
|
|
273
|
-
result = generateContextResult(testData.editOperation())
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
test('should use default TDD rules', () => {
|
|
277
|
-
expect(result).toContain(RULES)
|
|
278
|
-
})
|
|
279
|
-
})
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
describe('operation-specific context inclusion', () => {
|
|
283
|
-
describe('for Edit operations', () => {
|
|
284
|
-
let result: string
|
|
285
|
-
|
|
286
|
-
beforeEach(() => {
|
|
287
|
-
const editOperation = testData.editOperation()
|
|
288
|
-
result = generateContextResult(editOperation)
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
test('should include Edit context', () => {
|
|
292
|
-
expect(result).toContain(EDIT)
|
|
293
|
-
})
|
|
294
|
-
|
|
295
|
-
test('should not include MultiEdit context', () => {
|
|
296
|
-
expect(result).not.toContain(MULTI_EDIT)
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
test('should not include Write context', () => {
|
|
300
|
-
expect(result).not.toContain(WRITE)
|
|
301
|
-
})
|
|
302
|
-
})
|
|
303
|
-
|
|
304
|
-
describe('for MultiEdit operations', () => {
|
|
305
|
-
let result: string
|
|
306
|
-
|
|
307
|
-
beforeEach(() => {
|
|
308
|
-
const multiEditOperation = testData.multiEditOperation()
|
|
309
|
-
result = generateContextResult(multiEditOperation)
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
test('should include MultiEdit context', () => {
|
|
313
|
-
expect(result).toContain(MULTI_EDIT)
|
|
314
|
-
})
|
|
315
|
-
|
|
316
|
-
test('should not include Edit context', () => {
|
|
317
|
-
expect(result).not.toContain(EDIT)
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
test('should not include Write context', () => {
|
|
321
|
-
expect(result).not.toContain(WRITE)
|
|
322
|
-
})
|
|
323
|
-
})
|
|
324
|
-
|
|
325
|
-
describe('for Write operations', () => {
|
|
326
|
-
let result: string
|
|
327
|
-
|
|
328
|
-
beforeEach(() => {
|
|
329
|
-
const writeOperation = testData.writeOperation()
|
|
330
|
-
result = generateContextResult(writeOperation)
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
test('should include Write context', () => {
|
|
334
|
-
expect(result).toContain(WRITE)
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
test('should not include Edit context', () => {
|
|
338
|
-
expect(result).not.toContain(EDIT)
|
|
339
|
-
})
|
|
340
|
-
|
|
341
|
-
test('should not include MultiEdit context', () => {
|
|
342
|
-
expect(result).not.toContain(MULTI_EDIT)
|
|
343
|
-
})
|
|
344
|
-
})
|
|
345
|
-
})
|
|
346
|
-
})
|
|
347
|
-
|
|
348
|
-
// Test helpers
|
|
349
|
-
function generateContextResult(
|
|
350
|
-
operation: ToolOperation,
|
|
351
|
-
additionalContext?: { test?: string; todo?: string; instructions?: string }
|
|
352
|
-
) {
|
|
353
|
-
const context = {
|
|
354
|
-
modifications: JSON.stringify(operation),
|
|
355
|
-
...additionalContext,
|
|
356
|
-
}
|
|
357
|
-
return generateDynamicContext(context)
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function expectCorePrompts(result: string) {
|
|
361
|
-
expect(result).toContain(RULES)
|
|
362
|
-
expect(result).toContain(FILE_TYPES)
|
|
363
|
-
expect(result).toContain(RESPONSE)
|
|
364
|
-
}
|