xtrm-tools 2.0.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/CHANGELOG.md +496 -0
- package/README.md +762 -0
- package/cli/dist/index.cjs +55245 -0
- package/cli/dist/index.cjs.map +1 -0
- package/cli/dist/index.d.cts +2 -0
- package/cli/package.json +43 -0
- package/config/.env.example +40 -0
- package/config/hooks.json +36 -0
- package/config/mcp_servers.json +46 -0
- package/config/mcp_servers_optional.json +53 -0
- package/config/settings.json +70 -0
- package/hooks/README.md +156 -0
- package/hooks/__pycache__/agent_context.cpython-314.pyc +0 -0
- package/hooks/agent_context.py +105 -0
- package/hooks/gitnexus/gitnexus-hook.cjs +133 -0
- package/hooks/serena-workflow-reminder.py +74 -0
- package/hooks/skill-discovery.py +90 -0
- package/hooks/skill-suggestion.py +112 -0
- package/hooks/test_agent_context.py +112 -0
- package/hooks/type-safety-enforcement.py +107 -0
- package/package.json +48 -0
- package/project-skills/main-guard/.claude/hooks/main-guard.cjs +188 -0
- package/project-skills/main-guard/.claude/settings.json +16 -0
- package/project-skills/main-guard/.claude/skills/using-main-guard/SKILL.md +135 -0
- package/project-skills/main-guard/README.md +163 -0
- package/project-skills/py-quality-gate/.claude/hooks/quality-check.py +311 -0
- package/project-skills/py-quality-gate/.claude/settings.json +16 -0
- package/project-skills/py-quality-gate/.claude/skills/using-py-quality-gate/SKILL.md +112 -0
- package/project-skills/py-quality-gate/README.md +147 -0
- package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/doc_reminder.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/skill_staleness.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/git-hooks/doc_reminder.py +67 -0
- package/project-skills/service-skills-set/.claude/git-hooks/skill_staleness.py +194 -0
- package/project-skills/service-skills-set/.claude/service-registry.json +4 -0
- package/project-skills/service-skills-set/.claude/settings.json +37 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/SKILL.md +433 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/references/script_quality_standards.md +412 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/references/service_skill_system_guide.md +264 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/bootstrap.py +308 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/deep_dive.py +304 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/scaffolder.py +482 -0
- package/project-skills/service-skills-set/.claude/skills/scoping-service-skills/SKILL.md +231 -0
- package/project-skills/service-skills-set/.claude/skills/scoping-service-skills/scripts/scope.py +74 -0
- package/project-skills/service-skills-set/.claude/skills/updating-service-skills/SKILL.md +136 -0
- package/project-skills/service-skills-set/.claude/skills/updating-service-skills/scripts/__pycache__/drift_detector.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/updating-service-skills/scripts/drift_detector.py +222 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/SKILL.md +108 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/cataloger.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/skill_activator.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/cataloger.py +74 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/skill_activator.py +152 -0
- package/project-skills/service-skills-set/README.md +93 -0
- package/project-skills/service-skills-set/__pycache__/install-service-skills.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/install-service-skills.py +163 -0
- package/project-skills/service-skills-set/service-skills-readme.md +236 -0
- package/project-skills/tdd-guard/.claude/settings.json +38 -0
- package/project-skills/tdd-guard/.claude/skills/using-tdd-guard/SKILL.md +74 -0
- package/project-skills/tdd-guard/CLAUDE.md +98 -0
- package/project-skills/tdd-guard/CONTRIBUTING.md +38 -0
- package/project-skills/tdd-guard/DEVELOPMENT.md +127 -0
- package/project-skills/tdd-guard/LICENSE +21 -0
- package/project-skills/tdd-guard/README.md +396 -0
- package/project-skills/tdd-guard/docs/adr/001-claude-session-subdirectory.md +52 -0
- package/project-skills/tdd-guard/docs/adr/002-secure-claude-binary-path.md +56 -0
- package/project-skills/tdd-guard/docs/adr/003-remove-configurable-data-directory.md +56 -0
- package/project-skills/tdd-guard/docs/adr/004-monorepo-architecture.md +64 -0
- package/project-skills/tdd-guard/docs/adr/005-claude-project-dir-support.md +55 -0
- package/project-skills/tdd-guard/docs/adr/006-phpunit-separate-repository.md +93 -0
- package/project-skills/tdd-guard/docs/adr/007-golangci-lint-path-support.md +83 -0
- package/project-skills/tdd-guard/docs/adr/008-storybook-reporter-design.md +182 -0
- package/project-skills/tdd-guard/docs/assets/tdd-guard-demo-screenshot.gif +0 -0
- package/project-skills/tdd-guard/docs/config-migration.md +143 -0
- package/project-skills/tdd-guard/docs/configuration.md +137 -0
- package/project-skills/tdd-guard/docs/custom-instructions.md +43 -0
- package/project-skills/tdd-guard/docs/enforcement.md +46 -0
- package/project-skills/tdd-guard/docs/ignore-patterns.md +81 -0
- package/project-skills/tdd-guard/docs/linting.md +109 -0
- package/project-skills/tdd-guard/docs/quick-commands.md +52 -0
- package/project-skills/tdd-guard/docs/session-management.md +75 -0
- package/project-skills/tdd-guard/docs/storybook-vitest-addon.md +120 -0
- package/project-skills/tdd-guard/docs/validation-model.md +63 -0
- package/project-skills/tdd-guard/eslint.config.mjs +140 -0
- package/project-skills/tdd-guard/package-lock.json +16937 -0
- package/project-skills/tdd-guard/package.json +102 -0
- package/project-skills/tdd-guard/reporters/go/README.md +67 -0
- package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main.go +127 -0
- package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main_test.go +280 -0
- package/project-skills/tdd-guard/reporters/go/go.mod +3 -0
- package/project-skills/tdd-guard/reporters/go/go.sum +0 -0
- package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter.go +126 -0
- package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter_test.go +264 -0
- package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader.go +26 -0
- package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader_test.go +37 -0
- package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader.go +94 -0
- package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader_test.go +198 -0
- package/project-skills/tdd-guard/reporters/go/internal/parser/parser.go +245 -0
- package/project-skills/tdd-guard/reporters/go/internal/parser/parser_test.go +547 -0
- package/project-skills/tdd-guard/reporters/go/internal/storage/storage.go +35 -0
- package/project-skills/tdd-guard/reporters/go/internal/storage/storage_test.go +113 -0
- package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer.go +103 -0
- package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer_test.go +303 -0
- package/project-skills/tdd-guard/reporters/jest/README.md +102 -0
- package/project-skills/tdd-guard/reporters/jest/package.json +38 -0
- package/project-skills/tdd-guard/reporters/phpunit/.php-cs-fixer.php +28 -0
- package/project-skills/tdd-guard/reporters/phpunit/README.md +97 -0
- package/project-skills/tdd-guard/reporters/phpunit/SYNC_README.md +29 -0
- package/project-skills/tdd-guard/reporters/phpunit/composer.json +55 -0
- package/project-skills/tdd-guard/reporters/phpunit/phpunit.xml.dist +19 -0
- package/project-skills/tdd-guard/reporters/phpunit/psalm.xml +44 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/ErroredTestSubscriber.php +28 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/FailedTestSubscriber.php +28 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/IncompleteTestSubscriber.php +28 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/PassedTestSubscriber.php +27 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/SkippedTestSubscriber.php +28 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Event/TestRunnerFinishedSubscriber.php +24 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/PathValidator.php +88 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/Storage.php +26 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardExtension.php +33 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardListener.php +158 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardSubscriber.php +35 -0
- package/project-skills/tdd-guard/reporters/phpunit/src/TestResultCollector.php +105 -0
- package/project-skills/tdd-guard/reporters/phpunit/tests/PathValidatorTest.php +74 -0
- package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionFailedTest.php +241 -0
- package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionTest.php +84 -0
- package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardStorageLocationTest.php +71 -0
- package/project-skills/tdd-guard/reporters/pytest/README.md +77 -0
- package/project-skills/tdd-guard/reporters/pytest/pyproject.toml +43 -0
- package/project-skills/tdd-guard/reporters/pytest/pytest.ini.example +7 -0
- package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/__init__.py +1 -0
- package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/pytest_reporter.py +134 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/__init__.py +1 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/conftest.py +3 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/helpers.py +293 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/test_config_option.py +38 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/test_path_validation.py +59 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/test_plugin_config.py +32 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/test_project_root.py +296 -0
- package/project-skills/tdd-guard/reporters/pytest/tests/test_pytest_reporter.py +137 -0
- package/project-skills/tdd-guard/reporters/rspec/Gemfile +3 -0
- package/project-skills/tdd-guard/reporters/rust/Cargo.lock +458 -0
- package/project-skills/tdd-guard/reporters/rust/Cargo.toml +33 -0
- package/project-skills/tdd-guard/reporters/rust/Makefile.example +95 -0
- package/project-skills/tdd-guard/reporters/rust/README.md +88 -0
- package/project-skills/tdd-guard/reporters/rust/src/error_parser.rs +309 -0
- package/project-skills/tdd-guard/reporters/rust/src/main.rs +464 -0
- package/project-skills/tdd-guard/reporters/rust/src/parser.rs +225 -0
- package/project-skills/tdd-guard/reporters/rust/src/transformer.rs +409 -0
- package/project-skills/tdd-guard/reporters/storybook/README.md +108 -0
- package/project-skills/tdd-guard/reporters/storybook/package-lock.json +9482 -0
- package/project-skills/tdd-guard/reporters/storybook/package.json +43 -0
- package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test-data.ts +22 -0
- package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test.ts +190 -0
- package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.ts +88 -0
- package/project-skills/tdd-guard/reporters/storybook/src/index.ts +12 -0
- package/project-skills/tdd-guard/reporters/storybook/src/types.ts +37 -0
- package/project-skills/tdd-guard/reporters/storybook/tsconfig.json +11 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/go.mod +3 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/single_failing_test.go +13 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/go/import/go.mod +3 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/go/import/single_import_error_test.go +17 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/go.mod +3 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/single_passing_test.go +13 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-failing.test.js +5 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-import-error.test.js +8 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-passing.test.js +5 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleFailingTest.php +11 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleImportErrorTest.php +14 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SinglePassingTest.php +11 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_failing.py +3 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_import_error.py +6 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_passing.py +3 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.lock +7 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.toml +4 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/src/lib.rs +14 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.lock +7 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.toml +4 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/src/lib.rs +13 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.lock +7 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.toml +4 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/src/lib.rs +14 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/Calculator.js +4 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-failing.stories.js +15 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-import-error.stories.js +14 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-passing.stories.js +15 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-failing.test.js +7 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-import-error.test.js +9 -0
- package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-passing.test.js +7 -0
- package/project-skills/tdd-guard/reporters/test/factories/go.ts +59 -0
- package/project-skills/tdd-guard/reporters/test/factories/helpers.ts +48 -0
- package/project-skills/tdd-guard/reporters/test/factories/index.ts +7 -0
- package/project-skills/tdd-guard/reporters/test/factories/jest.ts +51 -0
- package/project-skills/tdd-guard/reporters/test/factories/phpunit.ts +63 -0
- package/project-skills/tdd-guard/reporters/test/factories/pytest.ts +41 -0
- package/project-skills/tdd-guard/reporters/test/factories/rust.ts +158 -0
- package/project-skills/tdd-guard/reporters/test/factories/storybook.ts +198 -0
- package/project-skills/tdd-guard/reporters/test/factories/vitest.ts +51 -0
- package/project-skills/tdd-guard/reporters/test/reporters.integration.test.ts +735 -0
- package/project-skills/tdd-guard/reporters/test/types.ts +28 -0
- package/project-skills/tdd-guard/reporters/vitest/README.md +64 -0
- package/project-skills/tdd-guard/reporters/vitest/package.json +35 -0
- package/project-skills/tdd-guard/src/cli/buildContext.test.ts +200 -0
- package/project-skills/tdd-guard/src/cli/buildContext.ts +48 -0
- package/project-skills/tdd-guard/src/cli/tdd-guard.test.ts +159 -0
- package/project-skills/tdd-guard/src/cli/tdd-guard.ts +48 -0
- package/project-skills/tdd-guard/src/config/Config.test.ts +538 -0
- package/project-skills/tdd-guard/src/config/Config.ts +172 -0
- package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.test.ts +58 -0
- package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.ts +8 -0
- package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.test.ts +347 -0
- package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.ts +61 -0
- package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.test.ts +24 -0
- package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.ts +7 -0
- package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.test.ts +377 -0
- package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.ts +75 -0
- package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.test.ts +563 -0
- package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.ts +140 -0
- package/project-skills/tdd-guard/src/contracts/types/ClientType.ts +1 -0
- package/project-skills/tdd-guard/src/contracts/types/ConfigOptions.ts +12 -0
- package/project-skills/tdd-guard/src/contracts/types/Context.ts +16 -0
- package/project-skills/tdd-guard/src/contracts/types/ModelClient.ts +3 -0
- package/project-skills/tdd-guard/src/contracts/types/ValidationResult.ts +6 -0
- package/project-skills/tdd-guard/src/guard/GuardManager.test.ts +336 -0
- package/project-skills/tdd-guard/src/guard/GuardManager.ts +83 -0
- package/project-skills/tdd-guard/src/hooks/HookEvents.test.ts +107 -0
- package/project-skills/tdd-guard/src/hooks/HookEvents.ts +39 -0
- package/project-skills/tdd-guard/src/hooks/fileTypeDetection.ts +16 -0
- package/project-skills/tdd-guard/src/hooks/postToolLint.test.ts +327 -0
- package/project-skills/tdd-guard/src/hooks/postToolLint.ts +165 -0
- package/project-skills/tdd-guard/src/hooks/processHookData.test.ts +465 -0
- package/project-skills/tdd-guard/src/hooks/processHookData.ts +203 -0
- package/project-skills/tdd-guard/src/hooks/sessionHandler.test.ts +136 -0
- package/project-skills/tdd-guard/src/hooks/sessionHandler.ts +31 -0
- package/project-skills/tdd-guard/src/hooks/userPromptHandler.test.ts +131 -0
- package/project-skills/tdd-guard/src/hooks/userPromptHandler.ts +55 -0
- package/project-skills/tdd-guard/src/index.ts +19 -0
- package/project-skills/tdd-guard/src/linters/Linter.ts +5 -0
- package/project-skills/tdd-guard/src/linters/eslint/ESLint.test.ts +183 -0
- package/project-skills/tdd-guard/src/linters/eslint/ESLint.ts +82 -0
- package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.test.ts +170 -0
- package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.ts +148 -0
- package/project-skills/tdd-guard/src/processors/index.ts +1 -0
- package/project-skills/tdd-guard/src/processors/lintProcessor.ts +77 -0
- package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.test.ts +303 -0
- package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.ts +255 -0
- package/project-skills/tdd-guard/src/providers/LinterProvider.test.ts +43 -0
- package/project-skills/tdd-guard/src/providers/LinterProvider.ts +20 -0
- package/project-skills/tdd-guard/src/providers/ModelClientProvider.test.ts +68 -0
- package/project-skills/tdd-guard/src/providers/ModelClientProvider.ts +22 -0
- package/project-skills/tdd-guard/src/storage/FileStorage.test.ts +76 -0
- package/project-skills/tdd-guard/src/storage/FileStorage.ts +108 -0
- package/project-skills/tdd-guard/src/storage/MemoryStorage.ts +57 -0
- package/project-skills/tdd-guard/src/storage/Storage.test.ts +227 -0
- package/project-skills/tdd-guard/src/storage/Storage.ts +17 -0
- package/project-skills/tdd-guard/src/validation/context/context.test.ts +364 -0
- package/project-skills/tdd-guard/src/validation/context/context.ts +155 -0
- package/project-skills/tdd-guard/src/validation/models/AnthropicApi.test.ts +171 -0
- package/project-skills/tdd-guard/src/validation/models/AnthropicApi.ts +49 -0
- package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.test.ts +167 -0
- package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.ts +54 -0
- package/project-skills/tdd-guard/src/validation/models/ClaudeCli.test.ts +239 -0
- package/project-skills/tdd-guard/src/validation/models/ClaudeCli.ts +57 -0
- package/project-skills/tdd-guard/src/validation/prompts/file-types.ts +52 -0
- package/project-skills/tdd-guard/src/validation/prompts/operations/edit.ts +58 -0
- package/project-skills/tdd-guard/src/validation/prompts/operations/multi-edit.ts +54 -0
- package/project-skills/tdd-guard/src/validation/prompts/operations/write.ts +54 -0
- package/project-skills/tdd-guard/src/validation/prompts/response.ts +40 -0
- package/project-skills/tdd-guard/src/validation/prompts/rules.ts +51 -0
- package/project-skills/tdd-guard/src/validation/prompts/system-prompt.ts +10 -0
- package/project-skills/tdd-guard/src/validation/prompts/tools/lint-results.ts +15 -0
- package/project-skills/tdd-guard/src/validation/prompts/tools/test-output.ts +14 -0
- package/project-skills/tdd-guard/src/validation/prompts/tools/todos.ts +9 -0
- package/project-skills/tdd-guard/src/validation/validator.test.ts +268 -0
- package/project-skills/tdd-guard/src/validation/validator.ts +159 -0
- package/project-skills/tdd-guard/test/artifacts/go/.golangci.yml +6 -0
- package/project-skills/tdd-guard/test/artifacts/go/with-issues/file-with-issues.go +12 -0
- package/project-skills/tdd-guard/test/artifacts/go/with-issues/go.mod +3 -0
- package/project-skills/tdd-guard/test/artifacts/go/without-issues/file-without-issues.go +7 -0
- package/project-skills/tdd-guard/test/artifacts/go/without-issues/go.mod +3 -0
- package/project-skills/tdd-guard/test/artifacts/javascript/eslint.config.js +20 -0
- package/project-skills/tdd-guard/test/artifacts/javascript/file-with-issues.js +12 -0
- package/project-skills/tdd-guard/test/artifacts/javascript/file-without-issues.js +10 -0
- package/project-skills/tdd-guard/test/hooks/fileTypeDetection.test.ts +26 -0
- package/project-skills/tdd-guard/test/hooks/processHookData.fileType.test.ts +46 -0
- package/project-skills/tdd-guard/test/hooks/processHookData.python.test.ts +68 -0
- package/project-skills/tdd-guard/test/integration/test-context.test.ts +66 -0
- package/project-skills/tdd-guard/test/integration/validator.core.test.ts +96 -0
- package/project-skills/tdd-guard/test/integration/validator.scenarios.test.ts +497 -0
- package/project-skills/tdd-guard/test/utils/assertions.ts +29 -0
- package/project-skills/tdd-guard/test/utils/factories/contextFactory.ts +30 -0
- package/project-skills/tdd-guard/test/utils/factories/editFactory.ts +82 -0
- package/project-skills/tdd-guard/test/utils/factories/helpers.test.ts +46 -0
- package/project-skills/tdd-guard/test/utils/factories/helpers.ts +46 -0
- package/project-skills/tdd-guard/test/utils/factories/lintFactory.ts +352 -0
- package/project-skills/tdd-guard/test/utils/factories/modelClientProviderFactory.ts +21 -0
- package/project-skills/tdd-guard/test/utils/factories/multiEditFactory.ts +79 -0
- package/project-skills/tdd-guard/test/utils/factories/operations.ts +57 -0
- package/project-skills/tdd-guard/test/utils/factories/reporterFactory.ts +55 -0
- package/project-skills/tdd-guard/test/utils/factories/scenarios/index.ts +22 -0
- package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/python.ts +745 -0
- package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/typescript.ts +767 -0
- package/project-skills/tdd-guard/test/utils/factories/scenarios/types.ts +77 -0
- package/project-skills/tdd-guard/test/utils/factories/scenarios/utils.ts +15 -0
- package/project-skills/tdd-guard/test/utils/factories/sessionStartFactory.ts +36 -0
- package/project-skills/tdd-guard/test/utils/factories/testDefaults.ts +90 -0
- package/project-skills/tdd-guard/test/utils/factories/testResultsFactory.ts +234 -0
- package/project-skills/tdd-guard/test/utils/factories/todoFactory.ts +99 -0
- package/project-skills/tdd-guard/test/utils/factories/userPromptSubmitFactory.ts +39 -0
- package/project-skills/tdd-guard/test/utils/factories/writeFactory.ts +70 -0
- package/project-skills/tdd-guard/test/utils/index.ts +131 -0
- package/project-skills/tdd-guard/tsconfig.build.json +16 -0
- package/project-skills/tdd-guard/tsconfig.eslint.json +17 -0
- package/project-skills/tdd-guard/tsconfig.json +32 -0
- package/project-skills/tdd-guard/tsconfig.node.json +10 -0
- package/project-skills/tdd-guard/vitest.config.ts +85 -0
- package/project-skills/ts-quality-gate/.claude/hooks/hook-config.json +66 -0
- package/project-skills/ts-quality-gate/.claude/hooks/quality-check.cjs +1251 -0
- package/project-skills/ts-quality-gate/.claude/settings.json +16 -0
- package/project-skills/ts-quality-gate/.claude/skills/using-ts-quality-gate/SKILL.md +81 -0
- package/project-skills/ts-quality-gate/README.md +115 -0
- package/skills/README.txt +31 -0
- package/skills/clean-code/SKILL.md +201 -0
- package/skills/delegating/SKILL.md +196 -0
- package/skills/delegating/config.yaml +210 -0
- package/skills/delegating/references/orchestration-protocols.md +41 -0
- package/skills/docker-expert/SKILL.md +409 -0
- package/skills/documenting/CHANGELOG.md +23 -0
- package/skills/documenting/README.md +148 -0
- package/skills/documenting/SKILL.md +113 -0
- package/skills/documenting/examples/example_pattern.md +70 -0
- package/skills/documenting/examples/example_reference.md +70 -0
- package/skills/documenting/examples/example_ssot_analytics.md +64 -0
- package/skills/documenting/examples/example_workflow.md +141 -0
- package/skills/documenting/references/changelog-format.md +97 -0
- package/skills/documenting/references/metadata-schema.md +136 -0
- package/skills/documenting/references/taxonomy.md +81 -0
- package/skills/documenting/references/versioning-rules.md +78 -0
- package/skills/documenting/scripts/__pycache__/drift_detector.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/__pycache__/orchestrator.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/__pycache__/validate_metadata.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/bump_version.sh +60 -0
- package/skills/documenting/scripts/changelog/__init__.py +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/add_entry.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/bump_release.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/validate_changelog.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/add_entry.py +216 -0
- package/skills/documenting/scripts/changelog/bump_release.py +117 -0
- package/skills/documenting/scripts/changelog/init_changelog.py +54 -0
- package/skills/documenting/scripts/changelog/validate_changelog.py +128 -0
- package/skills/documenting/scripts/drift_detector.py +266 -0
- package/skills/documenting/scripts/generate_template.py +311 -0
- package/skills/documenting/scripts/list_by_category.sh +84 -0
- package/skills/documenting/scripts/orchestrator.py +255 -0
- package/skills/documenting/scripts/validate_metadata.py +242 -0
- package/skills/documenting/templates/CHANGELOG.md.template +13 -0
- package/skills/documenting/tests/__pycache__/test_changelog.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_drift_detector.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_orchestrator.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_validate_metadata.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/integration_test.sh +70 -0
- package/skills/documenting/tests/test_changelog.py +201 -0
- package/skills/documenting/tests/test_drift_detector.py +80 -0
- package/skills/documenting/tests/test_orchestrator.py +52 -0
- package/skills/documenting/tests/test_validate_metadata.py +64 -0
- package/skills/find-skills/SKILL.md +133 -0
- package/skills/gitnexus-debugging/SKILL.md +85 -0
- package/skills/gitnexus-exploring/SKILL.md +75 -0
- package/skills/gitnexus-impact-analysis/SKILL.md +94 -0
- package/skills/gitnexus-refactoring/SKILL.md +113 -0
- package/skills/hook-development/SKILL.md +797 -0
- package/skills/hook-development/examples/load-context.sh +55 -0
- package/skills/hook-development/examples/quality-check.js +1168 -0
- package/skills/hook-development/examples/validate-bash.sh +43 -0
- package/skills/hook-development/examples/validate-write.sh +38 -0
- package/skills/hook-development/references/advanced.md +527 -0
- package/skills/hook-development/references/migration.md +369 -0
- package/skills/hook-development/references/patterns.md +412 -0
- package/skills/hook-development/scripts/README.md +164 -0
- package/skills/hook-development/scripts/hook-linter.sh +153 -0
- package/skills/hook-development/scripts/test-hook.sh +252 -0
- package/skills/hook-development/scripts/validate-hook-schema.sh +159 -0
- package/skills/obsidian-cli/SKILL.md +106 -0
- package/skills/orchestrating-agents/SKILL.md +135 -0
- package/skills/orchestrating-agents/config.yaml +45 -0
- package/skills/orchestrating-agents/references/agent-context-integration.md +37 -0
- package/skills/orchestrating-agents/references/examples.md +45 -0
- package/skills/orchestrating-agents/references/handover-protocol.md +31 -0
- package/skills/orchestrating-agents/references/workflows.md +42 -0
- package/skills/orchestrating-agents/scripts/detect_neighbors.py +23 -0
- package/skills/prompt-improving/README.md +162 -0
- package/skills/prompt-improving/SKILL.md +74 -0
- package/skills/prompt-improving/references/analysis_commands.md +24 -0
- package/skills/prompt-improving/references/chain_of_thought.md +24 -0
- package/skills/prompt-improving/references/mcp_definitions.md +20 -0
- package/skills/prompt-improving/references/multishot.md +23 -0
- package/skills/prompt-improving/references/xml_core.md +60 -0
- package/skills/python-testing/SKILL.md +815 -0
- package/skills/senior-backend/SKILL.md +209 -0
- package/skills/senior-backend/references/api_design_patterns.md +103 -0
- package/skills/senior-backend/references/backend_security_practices.md +103 -0
- package/skills/senior-backend/references/database_optimization_guide.md +103 -0
- package/skills/senior-backend/scripts/api_load_tester.py +114 -0
- package/skills/senior-backend/scripts/api_scaffolder.py +114 -0
- package/skills/senior-backend/scripts/database_migration_tool.py +114 -0
- package/skills/senior-data-scientist/SKILL.md +226 -0
- package/skills/senior-data-scientist/references/experiment_design_frameworks.md +80 -0
- package/skills/senior-data-scientist/references/feature_engineering_patterns.md +80 -0
- package/skills/senior-data-scientist/references/statistical_methods_advanced.md +80 -0
- package/skills/senior-data-scientist/scripts/experiment_designer.py +100 -0
- package/skills/senior-data-scientist/scripts/feature_engineering_pipeline.py +100 -0
- package/skills/senior-data-scientist/scripts/model_evaluation_suite.py +100 -0
- package/skills/senior-devops/SKILL.md +209 -0
- package/skills/senior-devops/references/cicd_pipeline_guide.md +103 -0
- package/skills/senior-devops/references/deployment_strategies.md +103 -0
- package/skills/senior-devops/references/infrastructure_as_code.md +103 -0
- package/skills/senior-devops/scripts/deployment_manager.py +114 -0
- package/skills/senior-devops/scripts/pipeline_generator.py +114 -0
- package/skills/senior-devops/scripts/terraform_scaffolder.py +114 -0
- package/skills/senior-security/SKILL.md +209 -0
- package/skills/senior-security/references/cryptography_implementation.md +103 -0
- package/skills/senior-security/references/penetration_testing_guide.md +103 -0
- package/skills/senior-security/references/security_architecture_patterns.md +103 -0
- package/skills/senior-security/scripts/pentest_automator.py +114 -0
- package/skills/senior-security/scripts/security_auditor.py +114 -0
- package/skills/senior-security/scripts/threat_modeler.py +114 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +479 -0
- package/skills/skill-creator/agents/analyzer.md +274 -0
- package/skills/skill-creator/agents/comparator.md +202 -0
- package/skills/skill-creator/agents/grader.md +223 -0
- package/skills/skill-creator/assets/eval_review.html +146 -0
- package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/skill-creator/references/schemas.md +430 -0
- package/skills/skill-creator/scripts/__init__.py +0 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/skill-creator/scripts/generate_report.py +326 -0
- package/skills/skill-creator/scripts/improve_description.py +248 -0
- package/skills/skill-creator/scripts/package_skill.py +136 -0
- package/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/skill-creator/scripts/run_eval.py +310 -0
- package/skills/skill-creator/scripts/run_loop.py +332 -0
- package/skills/skill-creator/scripts/utils.py +47 -0
- package/skills/using-TDD/SKILL.md +410 -0
- package/skills/using-serena-lsp/README.md +8 -0
- package/skills/using-serena-lsp/REFERENCE.md +194 -0
- package/skills/using-serena-lsp/SKILL.md +82 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import { describe, test, expect } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
TodoSchema,
|
|
4
|
+
EditSchema,
|
|
5
|
+
MultiEditSchema,
|
|
6
|
+
WriteSchema,
|
|
7
|
+
TodoWriteSchema,
|
|
8
|
+
EditOperationSchema,
|
|
9
|
+
MultiEditOperationSchema,
|
|
10
|
+
WriteOperationSchema,
|
|
11
|
+
TodoWriteOperationSchema,
|
|
12
|
+
ToolOperationSchema,
|
|
13
|
+
FileModificationSchema,
|
|
14
|
+
isEditOperation,
|
|
15
|
+
isMultiEditOperation,
|
|
16
|
+
isWriteOperation,
|
|
17
|
+
isTodoWriteOperation,
|
|
18
|
+
isFileModification,
|
|
19
|
+
UserPromptSubmitSchema,
|
|
20
|
+
SessionStartSchema,
|
|
21
|
+
} from './toolSchemas'
|
|
22
|
+
import { testData } from '@testUtils'
|
|
23
|
+
|
|
24
|
+
describe('Tool-specific schemas', () => {
|
|
25
|
+
describe('SessionStartSchema', () => {
|
|
26
|
+
test.each([
|
|
27
|
+
{
|
|
28
|
+
description: 'with startup source',
|
|
29
|
+
data: testData.sessionStart({ source: 'startup' }),
|
|
30
|
+
expectedSuccess: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
description: 'with resume source',
|
|
34
|
+
data: testData.sessionStart({ source: 'resume' }),
|
|
35
|
+
expectedSuccess: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
description: 'with clear source',
|
|
39
|
+
data: testData.sessionStart({ source: 'clear' }),
|
|
40
|
+
expectedSuccess: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
description: 'with invalid source',
|
|
44
|
+
data: { ...testData.sessionStart(), source: 'invalid' },
|
|
45
|
+
expectedSuccess: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
description: 'with wrong hook_event_name',
|
|
49
|
+
data: { ...testData.sessionStart(), hook_event_name: 'PreToolUse' },
|
|
50
|
+
expectedSuccess: false,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: 'without source',
|
|
54
|
+
data: testData.sessionStartWithout(['source']),
|
|
55
|
+
expectedSuccess: false,
|
|
56
|
+
},
|
|
57
|
+
])('$description', ({ data, expectedSuccess }) => {
|
|
58
|
+
const result = SessionStartSchema.safeParse(data)
|
|
59
|
+
expect(result.success).toBe(expectedSuccess)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
describe('UserPromptSubmitSchema', () => {
|
|
63
|
+
test.each([
|
|
64
|
+
{
|
|
65
|
+
description: 'with valid data',
|
|
66
|
+
data: testData.userPromptSubmit(),
|
|
67
|
+
expectedSuccess: true,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
description: 'with different prompt',
|
|
71
|
+
data: testData.userPromptSubmit({ prompt: 'tdd-guard off' }),
|
|
72
|
+
expectedSuccess: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
description: 'with wrong hook_event_name',
|
|
76
|
+
data: testData.userPromptSubmit({ hook_event_name: 'PreToolUse' }),
|
|
77
|
+
expectedSuccess: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
description: 'without prompt',
|
|
81
|
+
data: testData.userPromptSubmitWithout(['prompt']),
|
|
82
|
+
expectedSuccess: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
description: 'without cwd',
|
|
86
|
+
data: testData.userPromptSubmitWithout(['cwd']),
|
|
87
|
+
expectedSuccess: false,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
description: 'without session_id',
|
|
91
|
+
data: testData.userPromptSubmitWithout(['session_id']),
|
|
92
|
+
expectedSuccess: false,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
description: 'without transcript_path',
|
|
96
|
+
data: testData.userPromptSubmitWithout(['transcript_path']),
|
|
97
|
+
expectedSuccess: false,
|
|
98
|
+
},
|
|
99
|
+
])('$description', ({ data, expectedSuccess }) => {
|
|
100
|
+
const result = UserPromptSubmitSchema.safeParse(data)
|
|
101
|
+
expect(result.success).toBe(expectedSuccess)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
describe('TodoSchema', () => {
|
|
106
|
+
test.each([
|
|
107
|
+
{
|
|
108
|
+
description: 'without content',
|
|
109
|
+
todo: testData.todoWithout(['content']),
|
|
110
|
+
expectedSuccess: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
description: 'without status',
|
|
114
|
+
todo: testData.todoWithout(['status']),
|
|
115
|
+
expectedSuccess: false,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
description: 'without priority',
|
|
119
|
+
todo: testData.todoWithout(['priority']),
|
|
120
|
+
expectedSuccess: false,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
description: 'without id',
|
|
124
|
+
todo: testData.todoWithout(['id']),
|
|
125
|
+
expectedSuccess: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
description: 'with everything',
|
|
129
|
+
todo: testData.todo(),
|
|
130
|
+
expectedSuccess: true,
|
|
131
|
+
},
|
|
132
|
+
])('$description', ({ todo, expectedSuccess }) => {
|
|
133
|
+
const result = TodoSchema.safeParse(todo)
|
|
134
|
+
expect(result.success).toBe(expectedSuccess)
|
|
135
|
+
|
|
136
|
+
if (expectedSuccess && result.success) {
|
|
137
|
+
expect(result.data).toEqual(todo)
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
describe('EditSchema', () => {
|
|
143
|
+
test.each([
|
|
144
|
+
{
|
|
145
|
+
description: 'without file_path',
|
|
146
|
+
edit: testData.editWithout(['file_path']),
|
|
147
|
+
expectedSuccess: false,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
description: 'without old_string',
|
|
151
|
+
edit: testData.editWithout(['old_string']),
|
|
152
|
+
expectedSuccess: false,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
description: 'without new_string',
|
|
156
|
+
edit: testData.editWithout(['new_string']),
|
|
157
|
+
expectedSuccess: false,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
description: 'with everything',
|
|
161
|
+
edit: testData.edit(),
|
|
162
|
+
expectedSuccess: true,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
description: 'with replace_all true',
|
|
166
|
+
edit: testData.edit({ replace_all: true }),
|
|
167
|
+
expectedSuccess: true,
|
|
168
|
+
},
|
|
169
|
+
])('$description', ({ edit, expectedSuccess }) => {
|
|
170
|
+
const result = EditSchema.safeParse(edit)
|
|
171
|
+
expect(result.success).toBe(expectedSuccess)
|
|
172
|
+
|
|
173
|
+
if (expectedSuccess && result.success) {
|
|
174
|
+
expect(result.data).toEqual(edit)
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
describe('MultiEditSchema', () => {
|
|
180
|
+
test.each([
|
|
181
|
+
{
|
|
182
|
+
description: 'with valid multi-edit',
|
|
183
|
+
multiEdit: testData.multiEdit(),
|
|
184
|
+
expectedSuccess: true,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
description: 'without file_path',
|
|
188
|
+
multiEdit: testData.multiEditWithout(['file_path']),
|
|
189
|
+
expectedSuccess: false,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
description: 'without edits',
|
|
193
|
+
multiEdit: testData.multiEditWithout(['edits']),
|
|
194
|
+
expectedSuccess: false,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
description: 'with empty edits array',
|
|
198
|
+
multiEdit: testData.multiEdit({ edits: [] }),
|
|
199
|
+
expectedSuccess: false,
|
|
200
|
+
},
|
|
201
|
+
])('$description', ({ multiEdit, expectedSuccess }) => {
|
|
202
|
+
const result = MultiEditSchema.safeParse(multiEdit)
|
|
203
|
+
expect(result.success).toBe(expectedSuccess)
|
|
204
|
+
|
|
205
|
+
if (expectedSuccess && result.success) {
|
|
206
|
+
expect(result.data).toEqual(multiEdit)
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
describe('WriteSchema', () => {
|
|
212
|
+
test.each([
|
|
213
|
+
{
|
|
214
|
+
description: 'with valid write',
|
|
215
|
+
write: testData.write(),
|
|
216
|
+
expectedSuccess: true,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
description: 'without file_path',
|
|
220
|
+
write: testData.writeWithout(['file_path']),
|
|
221
|
+
expectedSuccess: false,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
description: 'without content',
|
|
225
|
+
write: testData.writeWithout(['content']),
|
|
226
|
+
expectedSuccess: false,
|
|
227
|
+
},
|
|
228
|
+
])('$description', ({ write, expectedSuccess }) => {
|
|
229
|
+
const result = WriteSchema.safeParse(write)
|
|
230
|
+
expect(result.success).toBe(expectedSuccess)
|
|
231
|
+
|
|
232
|
+
if (expectedSuccess && result.success) {
|
|
233
|
+
expect(result.data).toEqual(write)
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
describe('TodoWriteSchema', () => {
|
|
239
|
+
test.each([
|
|
240
|
+
{
|
|
241
|
+
description: 'with valid todo write',
|
|
242
|
+
todoWrite: testData.todoWrite(),
|
|
243
|
+
expectedSuccess: true,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
description: 'with empty todos array',
|
|
247
|
+
todoWrite: testData.todoWrite({ todos: [] }),
|
|
248
|
+
expectedSuccess: false,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
description: 'without todos',
|
|
252
|
+
todoWrite: testData.todoWriteWithout(['todos']),
|
|
253
|
+
expectedSuccess: false,
|
|
254
|
+
},
|
|
255
|
+
])('$description', ({ todoWrite, expectedSuccess }) => {
|
|
256
|
+
const result = TodoWriteSchema.safeParse(todoWrite)
|
|
257
|
+
expect(result.success).toBe(expectedSuccess)
|
|
258
|
+
|
|
259
|
+
if (expectedSuccess && result.success) {
|
|
260
|
+
expect(result.data).toEqual(todoWrite)
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
describe('EditOperationSchema', () => {
|
|
266
|
+
test.each([
|
|
267
|
+
{
|
|
268
|
+
description: 'with valid edit operation',
|
|
269
|
+
editOperation: testData.editOperation(),
|
|
270
|
+
expectedSuccess: true,
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
description: 'with wrong tool_name',
|
|
274
|
+
editOperation: testData.invalidEditOperation({ tool_name: 'Write' }),
|
|
275
|
+
expectedSuccess: false,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
description: 'without tool_input',
|
|
279
|
+
editOperation: testData.editOperationWithout(['tool_input']),
|
|
280
|
+
expectedSuccess: false,
|
|
281
|
+
},
|
|
282
|
+
])('$description', ({ editOperation, expectedSuccess }) => {
|
|
283
|
+
const result = EditOperationSchema.safeParse(editOperation)
|
|
284
|
+
expect(result.success).toBe(expectedSuccess)
|
|
285
|
+
|
|
286
|
+
if (expectedSuccess && result.success) {
|
|
287
|
+
expect(result.data).toEqual(editOperation)
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
describe('MultiEditOperationSchema', () => {
|
|
293
|
+
test.each([
|
|
294
|
+
{
|
|
295
|
+
description: 'with valid multi-edit operation',
|
|
296
|
+
multiEditOperation: testData.multiEditOperation(),
|
|
297
|
+
expectedSuccess: true,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
description: 'with wrong tool_name',
|
|
301
|
+
multiEditOperation: testData.invalidMultiEditOperation({
|
|
302
|
+
tool_name: 'Edit',
|
|
303
|
+
}),
|
|
304
|
+
expectedSuccess: false,
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
description: 'without tool_input',
|
|
308
|
+
multiEditOperation: testData.multiEditOperationWithout(['tool_input']),
|
|
309
|
+
expectedSuccess: false,
|
|
310
|
+
},
|
|
311
|
+
])('$description', ({ multiEditOperation, expectedSuccess }) => {
|
|
312
|
+
const result = MultiEditOperationSchema.safeParse(multiEditOperation)
|
|
313
|
+
expect(result.success).toBe(expectedSuccess)
|
|
314
|
+
|
|
315
|
+
if (expectedSuccess && result.success) {
|
|
316
|
+
expect(result.data).toEqual(multiEditOperation)
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
describe('WriteOperationSchema', () => {
|
|
322
|
+
test.each([
|
|
323
|
+
{
|
|
324
|
+
description: 'with valid write operation',
|
|
325
|
+
writeOperation: testData.writeOperation(),
|
|
326
|
+
expectedSuccess: true,
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
description: 'with wrong tool_name',
|
|
330
|
+
writeOperation: testData.invalidWriteOperation({ tool_name: 'Edit' }),
|
|
331
|
+
expectedSuccess: false,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
description: 'without tool_input',
|
|
335
|
+
writeOperation: testData.writeOperationWithout(['tool_input']),
|
|
336
|
+
expectedSuccess: false,
|
|
337
|
+
},
|
|
338
|
+
])('$description', ({ writeOperation, expectedSuccess }) => {
|
|
339
|
+
const result = WriteOperationSchema.safeParse(writeOperation)
|
|
340
|
+
expect(result.success).toBe(expectedSuccess)
|
|
341
|
+
|
|
342
|
+
if (expectedSuccess && result.success) {
|
|
343
|
+
expect(result.data).toEqual(writeOperation)
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
describe('TodoWriteOperationSchema', () => {
|
|
349
|
+
test.each([
|
|
350
|
+
{
|
|
351
|
+
description: 'with valid todo write operation',
|
|
352
|
+
todoWriteOperation: testData.todoWriteOperation(),
|
|
353
|
+
expectedSuccess: true,
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
description: 'with wrong tool_name',
|
|
357
|
+
todoWriteOperation: testData.invalidTodoWriteOperation({
|
|
358
|
+
tool_name: 'Edit',
|
|
359
|
+
}),
|
|
360
|
+
expectedSuccess: false,
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
description: 'without tool_input',
|
|
364
|
+
todoWriteOperation: testData.todoWriteOperationWithout(['tool_input']),
|
|
365
|
+
expectedSuccess: false,
|
|
366
|
+
},
|
|
367
|
+
])('$description', ({ todoWriteOperation, expectedSuccess }) => {
|
|
368
|
+
const result = TodoWriteOperationSchema.safeParse(todoWriteOperation)
|
|
369
|
+
expect(result.success).toBe(expectedSuccess)
|
|
370
|
+
|
|
371
|
+
if (expectedSuccess && result.success) {
|
|
372
|
+
expect(result.data).toEqual(todoWriteOperation)
|
|
373
|
+
}
|
|
374
|
+
})
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
describe('ToolOperationSchema', () => {
|
|
378
|
+
test.each([
|
|
379
|
+
{
|
|
380
|
+
description: 'with valid Edit operation',
|
|
381
|
+
toolOperation: testData.editOperation(),
|
|
382
|
+
expectedSuccess: true,
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
description: 'with valid MultiEdit operation',
|
|
386
|
+
toolOperation: testData.multiEditOperation(),
|
|
387
|
+
expectedSuccess: true,
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
description: 'with valid Write operation',
|
|
391
|
+
toolOperation: testData.writeOperation(),
|
|
392
|
+
expectedSuccess: true,
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
description: 'with valid TodoWrite operation',
|
|
396
|
+
toolOperation: testData.todoWriteOperation(),
|
|
397
|
+
expectedSuccess: true,
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
description: 'with unknown tool_name',
|
|
401
|
+
toolOperation: { tool_name: 'Unknown', tool_input: {} },
|
|
402
|
+
expectedSuccess: false,
|
|
403
|
+
},
|
|
404
|
+
])('$description', ({ toolOperation, expectedSuccess }) => {
|
|
405
|
+
const result = ToolOperationSchema.safeParse(toolOperation)
|
|
406
|
+
expect(result.success).toBe(expectedSuccess)
|
|
407
|
+
|
|
408
|
+
if (expectedSuccess && result.success) {
|
|
409
|
+
expect(result.data).toEqual(toolOperation)
|
|
410
|
+
}
|
|
411
|
+
})
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
describe('FileModificationSchema', () => {
|
|
415
|
+
test.each([
|
|
416
|
+
{
|
|
417
|
+
description: 'with valid Edit operation',
|
|
418
|
+
fileModification: testData.editOperation(),
|
|
419
|
+
expectedSuccess: true,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
description: 'with valid MultiEdit operation',
|
|
423
|
+
fileModification: testData.multiEditOperation(),
|
|
424
|
+
expectedSuccess: true,
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
description: 'with valid Write operation',
|
|
428
|
+
fileModification: testData.writeOperation(),
|
|
429
|
+
expectedSuccess: true,
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
description: 'with TodoWrite operation (should reject)',
|
|
433
|
+
fileModification: testData.todoWriteOperation(),
|
|
434
|
+
expectedSuccess: false,
|
|
435
|
+
},
|
|
436
|
+
])('$description', ({ fileModification, expectedSuccess }) => {
|
|
437
|
+
const result = FileModificationSchema.safeParse(fileModification)
|
|
438
|
+
expect(result.success).toBe(expectedSuccess)
|
|
439
|
+
|
|
440
|
+
if (expectedSuccess && result.success) {
|
|
441
|
+
expect(result.data).toEqual(fileModification)
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
})
|
|
445
|
+
})
|
|
446
|
+
|
|
447
|
+
describe('Type guards', () => {
|
|
448
|
+
// Create test data for all operation types
|
|
449
|
+
const editOperation = testData.editOperation()
|
|
450
|
+
const multiEditOperation = testData.multiEditOperation()
|
|
451
|
+
const writeOperation = testData.writeOperation()
|
|
452
|
+
const todoWriteOperation = testData.todoWriteOperation()
|
|
453
|
+
|
|
454
|
+
describe('isEditOperation', () => {
|
|
455
|
+
test.each([
|
|
456
|
+
{ operation: editOperation, operationType: 'Edit', expected: true },
|
|
457
|
+
{
|
|
458
|
+
operation: multiEditOperation,
|
|
459
|
+
operationType: 'MultiEdit',
|
|
460
|
+
expected: false,
|
|
461
|
+
},
|
|
462
|
+
{ operation: writeOperation, operationType: 'Write', expected: false },
|
|
463
|
+
{
|
|
464
|
+
operation: todoWriteOperation,
|
|
465
|
+
operationType: 'TodoWrite',
|
|
466
|
+
expected: false,
|
|
467
|
+
},
|
|
468
|
+
])(
|
|
469
|
+
'returns $expected for $operationType operation',
|
|
470
|
+
({ operation, expected }) => {
|
|
471
|
+
expect(isEditOperation(operation)).toBe(expected)
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
})
|
|
475
|
+
|
|
476
|
+
describe('isMultiEditOperation', () => {
|
|
477
|
+
test.each([
|
|
478
|
+
{ operation: editOperation, operationType: 'Edit', expected: false },
|
|
479
|
+
{
|
|
480
|
+
operation: multiEditOperation,
|
|
481
|
+
operationType: 'MultiEdit',
|
|
482
|
+
expected: true,
|
|
483
|
+
},
|
|
484
|
+
{ operation: writeOperation, operationType: 'Write', expected: false },
|
|
485
|
+
{
|
|
486
|
+
operation: todoWriteOperation,
|
|
487
|
+
operationType: 'TodoWrite',
|
|
488
|
+
expected: false,
|
|
489
|
+
},
|
|
490
|
+
])(
|
|
491
|
+
'returns $expected for $operationType operation',
|
|
492
|
+
({ operation, expected }) => {
|
|
493
|
+
expect(isMultiEditOperation(operation)).toBe(expected)
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
describe('isWriteOperation', () => {
|
|
499
|
+
test.each([
|
|
500
|
+
{ operation: editOperation, operationType: 'Edit', expected: false },
|
|
501
|
+
{
|
|
502
|
+
operation: multiEditOperation,
|
|
503
|
+
operationType: 'MultiEdit',
|
|
504
|
+
expected: false,
|
|
505
|
+
},
|
|
506
|
+
{ operation: writeOperation, operationType: 'Write', expected: true },
|
|
507
|
+
{
|
|
508
|
+
operation: todoWriteOperation,
|
|
509
|
+
operationType: 'TodoWrite',
|
|
510
|
+
expected: false,
|
|
511
|
+
},
|
|
512
|
+
])(
|
|
513
|
+
'returns $expected for $operationType operation',
|
|
514
|
+
({ operation, expected }) => {
|
|
515
|
+
expect(isWriteOperation(operation)).toBe(expected)
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
})
|
|
519
|
+
|
|
520
|
+
describe('isTodoWriteOperation', () => {
|
|
521
|
+
test.each([
|
|
522
|
+
{ operation: editOperation, operationType: 'Edit', expected: false },
|
|
523
|
+
{
|
|
524
|
+
operation: multiEditOperation,
|
|
525
|
+
operationType: 'MultiEdit',
|
|
526
|
+
expected: false,
|
|
527
|
+
},
|
|
528
|
+
{ operation: writeOperation, operationType: 'Write', expected: false },
|
|
529
|
+
{
|
|
530
|
+
operation: todoWriteOperation,
|
|
531
|
+
operationType: 'TodoWrite',
|
|
532
|
+
expected: true,
|
|
533
|
+
},
|
|
534
|
+
])(
|
|
535
|
+
'returns $expected for $operationType operation',
|
|
536
|
+
({ operation, expected }) => {
|
|
537
|
+
expect(isTodoWriteOperation(operation)).toBe(expected)
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
})
|
|
541
|
+
|
|
542
|
+
describe('isFileModification', () => {
|
|
543
|
+
test.each([
|
|
544
|
+
{ operation: editOperation, operationType: 'Edit', expected: true },
|
|
545
|
+
{
|
|
546
|
+
operation: multiEditOperation,
|
|
547
|
+
operationType: 'MultiEdit',
|
|
548
|
+
expected: true,
|
|
549
|
+
},
|
|
550
|
+
{ operation: writeOperation, operationType: 'Write', expected: true },
|
|
551
|
+
{
|
|
552
|
+
operation: todoWriteOperation,
|
|
553
|
+
operationType: 'TodoWrite',
|
|
554
|
+
expected: false,
|
|
555
|
+
},
|
|
556
|
+
])(
|
|
557
|
+
'returns $expected for $operationType operation',
|
|
558
|
+
({ operation, expected }) => {
|
|
559
|
+
expect(isFileModification(operation)).toBe(expected)
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
})
|
|
563
|
+
})
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
// Base Hook Context
|
|
4
|
+
export const HookContextSchema = z.object({
|
|
5
|
+
session_id: z.string(),
|
|
6
|
+
transcript_path: z.string(),
|
|
7
|
+
hook_event_name: z.string(),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const HookDataSchema = HookContextSchema.extend({
|
|
11
|
+
tool_name: z.string(),
|
|
12
|
+
tool_input: z.unknown(),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export type HookData = z.infer<typeof HookDataSchema>
|
|
16
|
+
|
|
17
|
+
// UserPromptSubmit Schema
|
|
18
|
+
export const UserPromptSubmitSchema = HookContextSchema.extend({
|
|
19
|
+
prompt: z.string(),
|
|
20
|
+
cwd: z.string(),
|
|
21
|
+
}).refine((data) => data.hook_event_name === 'UserPromptSubmit')
|
|
22
|
+
|
|
23
|
+
export type UserPromptSubmit = z.infer<typeof UserPromptSubmitSchema>
|
|
24
|
+
|
|
25
|
+
// SessionStart Schema
|
|
26
|
+
export const SessionStartSchema = HookContextSchema.extend({
|
|
27
|
+
hook_event_name: z.literal('SessionStart'),
|
|
28
|
+
source: z.enum(['startup', 'resume', 'clear']),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export type SessionStart = z.infer<typeof SessionStartSchema>
|
|
32
|
+
|
|
33
|
+
// Tool Input Schemas
|
|
34
|
+
export const TodoSchema = z.object({
|
|
35
|
+
content: z.string(),
|
|
36
|
+
status: z.enum(['pending', 'in_progress', 'completed']),
|
|
37
|
+
priority: z.enum(['high', 'medium', 'low']),
|
|
38
|
+
id: z.string(),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export type Todo = z.infer<typeof TodoSchema>
|
|
42
|
+
|
|
43
|
+
export const EditSchema = z.object({
|
|
44
|
+
file_path: z.string(),
|
|
45
|
+
old_string: z.string(),
|
|
46
|
+
new_string: z.string(),
|
|
47
|
+
replace_all: z.boolean().optional(),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export type Edit = z.infer<typeof EditSchema>
|
|
51
|
+
|
|
52
|
+
const EditEntrySchema = z.object({
|
|
53
|
+
old_string: z.string(),
|
|
54
|
+
new_string: z.string(),
|
|
55
|
+
replace_all: z.boolean().optional(),
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export const MultiEditSchema = z.object({
|
|
59
|
+
file_path: z.string(),
|
|
60
|
+
edits: z.array(EditEntrySchema).min(1),
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
export type MultiEdit = z.infer<typeof MultiEditSchema>
|
|
64
|
+
|
|
65
|
+
export const WriteSchema = z.object({
|
|
66
|
+
file_path: z.string(),
|
|
67
|
+
content: z.string(),
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export type Write = z.infer<typeof WriteSchema>
|
|
71
|
+
|
|
72
|
+
export const TodoWriteSchema = z.object({
|
|
73
|
+
todos: z.array(TodoSchema).min(1),
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
export type TodoWrite = z.infer<typeof TodoWriteSchema>
|
|
77
|
+
|
|
78
|
+
// Tool Operation Schemas
|
|
79
|
+
export const EditOperationSchema = HookContextSchema.extend({
|
|
80
|
+
tool_name: z.literal('Edit'),
|
|
81
|
+
tool_input: EditSchema,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
export const MultiEditOperationSchema = HookContextSchema.extend({
|
|
85
|
+
tool_name: z.literal('MultiEdit'),
|
|
86
|
+
tool_input: MultiEditSchema,
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
export const WriteOperationSchema = HookContextSchema.extend({
|
|
90
|
+
tool_name: z.literal('Write'),
|
|
91
|
+
tool_input: WriteSchema,
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
export const TodoWriteOperationSchema = HookContextSchema.extend({
|
|
95
|
+
tool_name: z.literal('TodoWrite'),
|
|
96
|
+
tool_input: TodoWriteSchema,
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
export type EditOperation = z.infer<typeof EditOperationSchema>
|
|
100
|
+
export type MultiEditOperation = z.infer<typeof MultiEditOperationSchema>
|
|
101
|
+
export type WriteOperation = z.infer<typeof WriteOperationSchema>
|
|
102
|
+
export type TodoWriteOperation = z.infer<typeof TodoWriteOperationSchema>
|
|
103
|
+
|
|
104
|
+
// Discriminated Unions
|
|
105
|
+
export const ToolOperationSchema = z.discriminatedUnion('tool_name', [
|
|
106
|
+
EditOperationSchema,
|
|
107
|
+
MultiEditOperationSchema,
|
|
108
|
+
WriteOperationSchema,
|
|
109
|
+
TodoWriteOperationSchema,
|
|
110
|
+
])
|
|
111
|
+
|
|
112
|
+
export type ToolOperation = z.infer<typeof ToolOperationSchema>
|
|
113
|
+
|
|
114
|
+
export const FileModificationSchema = z.discriminatedUnion('tool_name', [
|
|
115
|
+
EditOperationSchema,
|
|
116
|
+
MultiEditOperationSchema,
|
|
117
|
+
WriteOperationSchema,
|
|
118
|
+
])
|
|
119
|
+
|
|
120
|
+
export type FileModification = z.infer<typeof FileModificationSchema>
|
|
121
|
+
|
|
122
|
+
// Type Guards
|
|
123
|
+
export const isEditOperation = (op: ToolOperation): op is EditOperation =>
|
|
124
|
+
op.tool_name === 'Edit'
|
|
125
|
+
|
|
126
|
+
export const isMultiEditOperation = (
|
|
127
|
+
op: ToolOperation
|
|
128
|
+
): op is MultiEditOperation => op.tool_name === 'MultiEdit'
|
|
129
|
+
|
|
130
|
+
export const isWriteOperation = (op: ToolOperation): op is WriteOperation =>
|
|
131
|
+
op.tool_name === 'Write'
|
|
132
|
+
|
|
133
|
+
export const isTodoWriteOperation = (
|
|
134
|
+
op: ToolOperation
|
|
135
|
+
): op is TodoWriteOperation => op.tool_name === 'TodoWrite'
|
|
136
|
+
|
|
137
|
+
export const isFileModification = (op: ToolOperation): op is FileModification =>
|
|
138
|
+
op.tool_name === 'Edit' ||
|
|
139
|
+
op.tool_name === 'MultiEdit' ||
|
|
140
|
+
op.tool_name === 'Write'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ClientType = 'api' | 'cli' | 'sdk'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ClientType } from './ClientType'
|
|
2
|
+
|
|
3
|
+
export type ConfigOptions = {
|
|
4
|
+
mode?: 'production' | 'test'
|
|
5
|
+
projectRoot?: string
|
|
6
|
+
useSystemClaude?: boolean
|
|
7
|
+
anthropicApiKey?: string
|
|
8
|
+
modelType?: string
|
|
9
|
+
modelVersion?: string
|
|
10
|
+
linterType?: string
|
|
11
|
+
validationClient?: ClientType
|
|
12
|
+
}
|