@weavelogic/knowledge-graph-agent 0.2.0 → 0.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 +972 -303
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/additionalItems.js +5 -0
- package/dist/_virtual/additionalItems.js.map +1 -0
- package/dist/_virtual/additionalProperties.js +5 -0
- package/dist/_virtual/additionalProperties.js.map +1 -0
- package/dist/_virtual/ajv.js +6 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/ajv2.js +5 -0
- package/dist/_virtual/ajv2.js.map +1 -0
- package/dist/_virtual/allOf.js +5 -0
- package/dist/_virtual/allOf.js.map +1 -0
- package/dist/_virtual/anyOf.js +5 -0
- package/dist/_virtual/anyOf.js.map +1 -0
- package/dist/_virtual/applicability.js +5 -0
- package/dist/_virtual/applicability.js.map +1 -0
- package/dist/_virtual/boolSchema.js +5 -0
- package/dist/_virtual/boolSchema.js.map +1 -0
- package/dist/_virtual/code.js +5 -0
- package/dist/_virtual/code.js.map +1 -0
- package/dist/_virtual/code2.js +5 -0
- package/dist/_virtual/code2.js.map +1 -0
- package/dist/_virtual/const.js +5 -0
- package/dist/_virtual/const.js.map +1 -0
- package/dist/_virtual/contains.js +5 -0
- package/dist/_virtual/contains.js.map +1 -0
- package/dist/_virtual/core.js +5 -0
- package/dist/_virtual/core.js.map +1 -0
- package/dist/_virtual/dataType.js +5 -0
- package/dist/_virtual/dataType.js.map +1 -0
- package/dist/_virtual/defaults.js +5 -0
- package/dist/_virtual/defaults.js.map +1 -0
- package/dist/_virtual/dependencies.js +5 -0
- package/dist/_virtual/dependencies.js.map +1 -0
- package/dist/_virtual/draft7.js +5 -0
- package/dist/_virtual/draft7.js.map +1 -0
- package/dist/_virtual/enum.js +5 -0
- package/dist/_virtual/enum.js.map +1 -0
- package/dist/_virtual/equal.js +5 -0
- package/dist/_virtual/equal.js.map +1 -0
- package/dist/_virtual/errors.js +5 -0
- package/dist/_virtual/errors.js.map +1 -0
- package/dist/_virtual/format.js +5 -0
- package/dist/_virtual/format.js.map +1 -0
- package/dist/_virtual/formats.js +5 -0
- package/dist/_virtual/formats.js.map +1 -0
- package/dist/_virtual/id.js +5 -0
- package/dist/_virtual/id.js.map +1 -0
- package/dist/_virtual/if.js +5 -0
- package/dist/_virtual/if.js.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index10.js +5 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +5 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index12.js +5 -0
- package/dist/_virtual/index12.js.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +5 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +5 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +5 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +5 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/items.js +5 -0
- package/dist/_virtual/items.js.map +1 -0
- package/dist/_virtual/items2020.js +5 -0
- package/dist/_virtual/items2020.js.map +1 -0
- package/dist/_virtual/keyword.js +5 -0
- package/dist/_virtual/keyword.js.map +1 -0
- package/dist/_virtual/limit.js +5 -0
- package/dist/_virtual/limit.js.map +1 -0
- package/dist/_virtual/limitItems.js +5 -0
- package/dist/_virtual/limitItems.js.map +1 -0
- package/dist/_virtual/limitLength.js +5 -0
- package/dist/_virtual/limitLength.js.map +1 -0
- package/dist/_virtual/limitNumber.js +5 -0
- package/dist/_virtual/limitNumber.js.map +1 -0
- package/dist/_virtual/limitProperties.js +5 -0
- package/dist/_virtual/limitProperties.js.map +1 -0
- package/dist/_virtual/metadata.js +5 -0
- package/dist/_virtual/metadata.js.map +1 -0
- package/dist/_virtual/multipleOf.js +5 -0
- package/dist/_virtual/multipleOf.js.map +1 -0
- package/dist/_virtual/names.js +5 -0
- package/dist/_virtual/names.js.map +1 -0
- package/dist/_virtual/not.js +5 -0
- package/dist/_virtual/not.js.map +1 -0
- package/dist/_virtual/oneOf.js +5 -0
- package/dist/_virtual/oneOf.js.map +1 -0
- package/dist/_virtual/pattern.js +5 -0
- package/dist/_virtual/pattern.js.map +1 -0
- package/dist/_virtual/patternProperties.js +5 -0
- package/dist/_virtual/patternProperties.js.map +1 -0
- package/dist/_virtual/prefixItems.js +5 -0
- package/dist/_virtual/prefixItems.js.map +1 -0
- package/dist/_virtual/properties.js +5 -0
- package/dist/_virtual/properties.js.map +1 -0
- package/dist/_virtual/propertyNames.js +5 -0
- package/dist/_virtual/propertyNames.js.map +1 -0
- package/dist/_virtual/ref.js +5 -0
- package/dist/_virtual/ref.js.map +1 -0
- package/dist/_virtual/ref_error.js +5 -0
- package/dist/_virtual/ref_error.js.map +1 -0
- package/dist/_virtual/required.js +5 -0
- package/dist/_virtual/required.js.map +1 -0
- package/dist/_virtual/resolve.js +5 -0
- package/dist/_virtual/resolve.js.map +1 -0
- package/dist/_virtual/rules.js +5 -0
- package/dist/_virtual/rules.js.map +1 -0
- package/dist/_virtual/scope.js +5 -0
- package/dist/_virtual/scope.js.map +1 -0
- package/dist/_virtual/subschema.js +5 -0
- package/dist/_virtual/subschema.js.map +1 -0
- package/dist/_virtual/thenElse.js +5 -0
- package/dist/_virtual/thenElse.js.map +1 -0
- package/dist/_virtual/types.js +5 -0
- package/dist/_virtual/types.js.map +1 -0
- package/dist/_virtual/ucs2length.js +5 -0
- package/dist/_virtual/ucs2length.js.map +1 -0
- package/dist/_virtual/uniqueItems.js +5 -0
- package/dist/_virtual/uniqueItems.js.map +1 -0
- package/dist/_virtual/uri.js +5 -0
- package/dist/_virtual/uri.js.map +1 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/_virtual/util.js.map +1 -0
- package/dist/_virtual/validation_error.js +5 -0
- package/dist/_virtual/validation_error.js.map +1 -0
- package/dist/agents/analyst-agent.d.ts +230 -0
- package/dist/agents/analyst-agent.d.ts.map +1 -0
- package/dist/agents/analyst-agent.js +793 -0
- package/dist/agents/analyst-agent.js.map +1 -0
- package/dist/agents/architect-agent.d.ts +248 -0
- package/dist/agents/architect-agent.d.ts.map +1 -0
- package/dist/agents/architect-agent.js +685 -0
- package/dist/agents/architect-agent.js.map +1 -0
- package/dist/agents/base-agent.d.ts +169 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +441 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/coder-agent.d.ts +191 -0
- package/dist/agents/coder-agent.d.ts.map +1 -0
- package/dist/agents/coder-agent.js +1008 -0
- package/dist/agents/coder-agent.js.map +1 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +40 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.d.ts +213 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +419 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/researcher-agent.d.ts +226 -0
- package/dist/agents/researcher-agent.d.ts.map +1 -0
- package/dist/agents/researcher-agent.js +572 -0
- package/dist/agents/researcher-agent.js.map +1 -0
- package/dist/agents/rules-engine.d.ts +320 -0
- package/dist/agents/rules-engine.d.ts.map +1 -0
- package/dist/agents/rules-engine.js +552 -0
- package/dist/agents/rules-engine.js.map +1 -0
- package/dist/agents/tester-agent.d.ts +219 -0
- package/dist/agents/tester-agent.d.ts.map +1 -0
- package/dist/agents/tester-agent.js +683 -0
- package/dist/agents/tester-agent.js.map +1 -0
- package/dist/agents/types.d.ts +425 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +57 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/audit/config.d.ts +150 -0
- package/dist/audit/config.d.ts.map +1 -0
- package/dist/audit/config.js +111 -0
- package/dist/audit/config.js.map +1 -0
- package/dist/audit/index.d.ts +38 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.d.ts +276 -0
- package/dist/audit/services/audit-chain.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.js +502 -0
- package/dist/audit/services/audit-chain.js.map +1 -0
- package/dist/audit/services/index.d.ts +11 -0
- package/dist/audit/services/index.d.ts.map +1 -0
- package/dist/audit/services/syndication.d.ts +334 -0
- package/dist/audit/services/syndication.d.ts.map +1 -0
- package/dist/audit/services/syndication.js +589 -0
- package/dist/audit/services/syndication.js.map +1 -0
- package/dist/audit/types.d.ts +453 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/caching/index.d.ts +55 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +206 -0
- package/dist/caching/index.js.map +1 -0
- package/dist/caching/lru-cache.d.ts +254 -0
- package/dist/caching/lru-cache.d.ts.map +1 -0
- package/dist/caching/types.d.ts +95 -0
- package/dist/caching/types.d.ts.map +1 -0
- package/dist/chunking/chunker.d.ts +94 -0
- package/dist/chunking/chunker.d.ts.map +1 -0
- package/dist/chunking/index.d.ts +125 -0
- package/dist/chunking/index.d.ts.map +1 -0
- package/dist/chunking/index.js +283 -0
- package/dist/chunking/index.js.map +1 -0
- package/dist/chunking/types.d.ts +92 -0
- package/dist/chunking/types.d.ts.map +1 -0
- package/dist/cli/commands/audit.d.ts +21 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +621 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +11 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +379 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/config.d.ts +8 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +107 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/cultivate.d.ts +16 -0
- package/dist/cli/commands/cultivate.d.ts.map +1 -0
- package/dist/cli/commands/cultivate.js +254 -0
- package/dist/cli/commands/cultivate.js.map +1 -0
- package/dist/cli/commands/diagnostics.d.ts +8 -0
- package/dist/cli/commands/diagnostics.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics.js +140 -0
- package/dist/cli/commands/diagnostics.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +13 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/init-primitives.d.ts +19 -0
- package/dist/cli/commands/init-primitives.d.ts.map +1 -0
- package/dist/cli/commands/init-primitives.js +208 -0
- package/dist/cli/commands/init-primitives.js.map +1 -0
- package/dist/cli/commands/sop.d.ts +14 -0
- package/dist/cli/commands/sop.d.ts.map +1 -0
- package/dist/cli/commands/sop.js +598 -0
- package/dist/cli/commands/sop.js.map +1 -0
- package/dist/cli/commands/vector.d.ts +14 -0
- package/dist/cli/commands/vector.d.ts.map +1 -0
- package/dist/cli/commands/vector.js +429 -0
- package/dist/cli/commands/vector.js.map +1 -0
- package/dist/cli/commands/workflow.d.ts +12 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +471 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +66 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +153 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +141 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +136 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/types.d.ts +127 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/cache.d.ts +185 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +435 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/cultivation/deep-analyzer.d.ts +129 -0
- package/dist/cultivation/deep-analyzer.d.ts.map +1 -0
- package/dist/cultivation/deep-analyzer.js +322 -0
- package/dist/cultivation/deep-analyzer.js.map +1 -0
- package/dist/cultivation/index.d.ts +13 -0
- package/dist/cultivation/index.d.ts.map +1 -0
- package/dist/cultivation/seed-generator.d.ts +92 -0
- package/dist/cultivation/seed-generator.d.ts.map +1 -0
- package/dist/cultivation/seed-generator.js +1033 -0
- package/dist/cultivation/seed-generator.js.map +1 -0
- package/dist/cultivation/types.d.ts +230 -0
- package/dist/cultivation/types.d.ts.map +1 -0
- package/dist/database/schemas/index.d.ts +85 -0
- package/dist/database/schemas/index.d.ts.map +1 -0
- package/dist/generators/claude-md.d.ts +7 -0
- package/dist/generators/claude-md.d.ts.map +1 -1
- package/dist/generators/claude-md.js.map +1 -1
- package/dist/generators/docs-init.d.ts +6 -0
- package/dist/generators/docs-init.d.ts.map +1 -1
- package/dist/generators/docs-init.js.map +1 -1
- package/dist/health/checks.d.ts +135 -0
- package/dist/health/checks.d.ts.map +1 -0
- package/dist/health/index.d.ts +119 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +191 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/monitor.d.ts +146 -0
- package/dist/health/monitor.d.ts.map +1 -0
- package/dist/health/types.d.ts +135 -0
- package/dist/health/types.d.ts.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +182 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/auto-commit.d.ts +175 -0
- package/dist/integrations/auto-commit.d.ts.map +1 -0
- package/dist/integrations/auto-commit.js +399 -0
- package/dist/integrations/auto-commit.js.map +1 -0
- package/dist/integrations/git.d.ts +299 -0
- package/dist/integrations/git.d.ts.map +1 -0
- package/dist/integrations/git.js +465 -0
- package/dist/integrations/git.js.map +1 -0
- package/dist/mcp-server/bin.d.ts +11 -0
- package/dist/mcp-server/bin.d.ts.map +1 -0
- package/dist/mcp-server/handlers/index.d.ts +57 -0
- package/dist/mcp-server/handlers/index.d.ts.map +1 -0
- package/dist/mcp-server/handlers/index.js +235 -0
- package/dist/mcp-server/handlers/index.js.map +1 -0
- package/dist/mcp-server/index.d.ts +28 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/server.d.ts +133 -0
- package/dist/mcp-server/server.d.ts.map +1 -0
- package/dist/mcp-server/server.js +280 -0
- package/dist/mcp-server/server.js.map +1 -0
- package/dist/mcp-server/tools/agents/index.d.ts +10 -0
- package/dist/mcp-server/tools/agents/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/agents/list.d.ts +19 -0
- package/dist/mcp-server/tools/agents/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/agents/spawn.d.ts +19 -0
- package/dist/mcp-server/tools/agents/spawn.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/checkpoint.d.ts +58 -0
- package/dist/mcp-server/tools/audit/checkpoint.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/checkpoint.js +73 -0
- package/dist/mcp-server/tools/audit/checkpoint.js.map +1 -0
- package/dist/mcp-server/tools/audit/index.d.ts +53 -0
- package/dist/mcp-server/tools/audit/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/index.js +12 -0
- package/dist/mcp-server/tools/audit/index.js.map +1 -0
- package/dist/mcp-server/tools/audit/query.d.ts +58 -0
- package/dist/mcp-server/tools/audit/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/query.js +125 -0
- package/dist/mcp-server/tools/audit/query.js.map +1 -0
- package/dist/mcp-server/tools/audit/sync.d.ts +58 -0
- package/dist/mcp-server/tools/audit/sync.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/sync.js +126 -0
- package/dist/mcp-server/tools/audit/sync.js.map +1 -0
- package/dist/mcp-server/tools/graph/generate.d.ts +21 -0
- package/dist/mcp-server/tools/graph/generate.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/index.d.ts +11 -0
- package/dist/mcp-server/tools/graph/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/query.d.ts +22 -0
- package/dist/mcp-server/tools/graph/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/stats.d.ts +22 -0
- package/dist/mcp-server/tools/graph/stats.d.ts.map +1 -0
- package/dist/mcp-server/tools/health.d.ts +21 -0
- package/dist/mcp-server/tools/health.d.ts.map +1 -0
- package/dist/mcp-server/tools/index.d.ts +16 -0
- package/dist/mcp-server/tools/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/registry.d.ts +90 -0
- package/dist/mcp-server/tools/registry.d.ts.map +1 -0
- package/dist/mcp-server/tools/registry.js +753 -0
- package/dist/mcp-server/tools/registry.js.map +1 -0
- package/dist/mcp-server/tools/search/index.d.ts +10 -0
- package/dist/mcp-server/tools/search/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/search/nodes.d.ts +22 -0
- package/dist/mcp-server/tools/search/nodes.d.ts.map +1 -0
- package/dist/mcp-server/tools/search/tags.d.ts +22 -0
- package/dist/mcp-server/tools/search/tags.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/index.d.ts +12 -0
- package/dist/mcp-server/tools/vector/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/index.js +12 -0
- package/dist/mcp-server/tools/vector/index.js.map +1 -0
- package/dist/mcp-server/tools/vector/search.d.ts +41 -0
- package/dist/mcp-server/tools/vector/search.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/search.js +224 -0
- package/dist/mcp-server/tools/vector/search.js.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts +39 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.js +170 -0
- package/dist/mcp-server/tools/vector/trajectory.js.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts +44 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.js +175 -0
- package/dist/mcp-server/tools/vector/upsert.js.map +1 -0
- package/dist/mcp-server/tools/workflow/index.d.ts +29 -0
- package/dist/mcp-server/tools/workflow/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/index.js +12 -0
- package/dist/mcp-server/tools/workflow/index.js.map +1 -0
- package/dist/mcp-server/tools/workflow/list.d.ts +41 -0
- package/dist/mcp-server/tools/workflow/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/list.js +195 -0
- package/dist/mcp-server/tools/workflow/list.js.map +1 -0
- package/dist/mcp-server/tools/workflow/start.d.ts +40 -0
- package/dist/mcp-server/tools/workflow/start.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/start.js +165 -0
- package/dist/mcp-server/tools/workflow/start.js.map +1 -0
- package/dist/mcp-server/tools/workflow/status.d.ts +38 -0
- package/dist/mcp-server/tools/workflow/status.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/status.js +97 -0
- package/dist/mcp-server/tools/workflow/status.js.map +1 -0
- package/dist/mcp-server/types/index.d.ts +286 -0
- package/dist/mcp-server/types/index.d.ts.map +1 -0
- package/dist/memory/index.d.ts +10 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/vault-sync.d.ts +212 -0
- package/dist/memory/vault-sync.d.ts.map +1 -0
- package/dist/memory/vault-sync.js +463 -0
- package/dist/memory/vault-sync.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +296 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +71 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +26 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +407 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1332 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +71 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/node_modules/ajv/dist/ajv.js +84 -0
- package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js +160 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js +728 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js +152 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/errors.js +131 -0
- package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +234 -0
- package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/names.js +44 -0
- package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js +22 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js +163 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/rules.js +35 -0
- package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/util.js +173 -0
- package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +58 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js +193 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js +43 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js +522 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js +126 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js +89 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/dist/node_modules/ajv/dist/core.js +628 -0
- package/dist/node_modules/ajv/dist/core.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js +24 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +25 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js +16 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js +30 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js +16 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js +20 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +114 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +32 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +22 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +100 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +103 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +75 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +68 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +43 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +81 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +66 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +49 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +23 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js +140 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +132 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +114 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js +95 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +16 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +36 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +56 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +52 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +39 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +37 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +33 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +89 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/formats.js +209 -0
- package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/index.js +51 -0
- package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/limit.js +80 -0
- package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +39 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-uri/index.js +261 -0
- package/dist/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +215 -0
- package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/utils.js +261 -0
- package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +92 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/errors.js +37 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/iso.js +43 -0
- package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +13 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +688 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +492 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +405 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +58 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +38 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +82 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +60 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +87 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +52 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +1283 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +341 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +9 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
- package/dist/reasoning/index.d.ts +74 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/index.js +124 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/tracker.d.ts +210 -0
- package/dist/reasoning/tracker.d.ts.map +1 -0
- package/dist/reasoning/types.d.ts +146 -0
- package/dist/reasoning/types.d.ts.map +1 -0
- package/dist/recovery/backup.d.ts +110 -0
- package/dist/recovery/backup.d.ts.map +1 -0
- package/dist/recovery/index.d.ts +70 -0
- package/dist/recovery/index.d.ts.map +1 -0
- package/dist/recovery/index.js +186 -0
- package/dist/recovery/index.js.map +1 -0
- package/dist/recovery/integrity.d.ts +74 -0
- package/dist/recovery/integrity.d.ts.map +1 -0
- package/dist/recovery/types.d.ts +94 -0
- package/dist/recovery/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +130 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +134 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/manager.d.ts +140 -0
- package/dist/services/manager.d.ts.map +1 -0
- package/dist/services/types.d.ts +106 -0
- package/dist/services/types.d.ts.map +1 -0
- package/dist/services/watchers.d.ts +95 -0
- package/dist/services/watchers.d.ts.map +1 -0
- package/dist/sops/compliance-checker.d.ts +83 -0
- package/dist/sops/compliance-checker.d.ts.map +1 -0
- package/dist/sops/compliance-checker.js +399 -0
- package/dist/sops/compliance-checker.js.map +1 -0
- package/dist/sops/gap-analyzer.d.ts +124 -0
- package/dist/sops/gap-analyzer.d.ts.map +1 -0
- package/dist/sops/gap-analyzer.js +313 -0
- package/dist/sops/gap-analyzer.js.map +1 -0
- package/dist/sops/index.d.ts +14 -0
- package/dist/sops/index.d.ts.map +1 -0
- package/dist/sops/overlay-manager.d.ts +115 -0
- package/dist/sops/overlay-manager.d.ts.map +1 -0
- package/dist/sops/overlay-manager.js +394 -0
- package/dist/sops/overlay-manager.js.map +1 -0
- package/dist/sops/registry.d.ts +73 -0
- package/dist/sops/registry.d.ts.map +1 -0
- package/dist/sops/registry.js +919 -0
- package/dist/sops/registry.js.map +1 -0
- package/dist/sops/types.d.ts +377 -0
- package/dist/sops/types.d.ts.map +1 -0
- package/dist/sops/types.js +46 -0
- package/dist/sops/types.js.map +1 -0
- package/dist/utils/error-recovery.d.ts +230 -0
- package/dist/utils/error-recovery.d.ts.map +1 -0
- package/dist/utils/error-recovery.js +228 -0
- package/dist/utils/error-recovery.js.map +1 -0
- package/dist/utils/error-taxonomy.d.ts +149 -0
- package/dist/utils/error-taxonomy.d.ts.map +1 -0
- package/dist/utils/error-taxonomy.js +260 -0
- package/dist/utils/error-taxonomy.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +139 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +311 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/vector/config.d.ts +300 -0
- package/dist/vector/config.d.ts.map +1 -0
- package/dist/vector/config.js +124 -0
- package/dist/vector/config.js.map +1 -0
- package/dist/vector/index.d.ts +50 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/services/index.d.ts +13 -0
- package/dist/vector/services/index.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.d.ts +405 -0
- package/dist/vector/services/trajectory-tracker.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.js +445 -0
- package/dist/vector/services/trajectory-tracker.js.map +1 -0
- package/dist/vector/services/vector-store.d.ts +339 -0
- package/dist/vector/services/vector-store.d.ts.map +1 -0
- package/dist/vector/services/vector-store.js +748 -0
- package/dist/vector/services/vector-store.js.map +1 -0
- package/dist/vector/types.d.ts +677 -0
- package/dist/vector/types.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.d.ts +196 -0
- package/dist/workflow/adapters/goap-adapter.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.js +706 -0
- package/dist/workflow/adapters/goap-adapter.js.map +1 -0
- package/dist/workflow/adapters/index.d.ts +10 -0
- package/dist/workflow/adapters/index.d.ts.map +1 -0
- package/dist/workflow/config.d.ts +135 -0
- package/dist/workflow/config.d.ts.map +1 -0
- package/dist/workflow/config.js +92 -0
- package/dist/workflow/config.js.map +1 -0
- package/dist/workflow/handlers/index.d.ts +9 -0
- package/dist/workflow/handlers/index.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts +397 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.js +454 -0
- package/dist/workflow/handlers/webhook-handlers.js.map +1 -0
- package/dist/workflow/index.d.ts +42 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/services/index.d.ts +9 -0
- package/dist/workflow/services/index.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.d.ts +318 -0
- package/dist/workflow/services/workflow-service.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.js +577 -0
- package/dist/workflow/services/workflow-service.js.map +1 -0
- package/dist/workflow/types.d.ts +470 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/workflows/realtime-collab.d.ts +245 -0
- package/dist/workflow/workflows/realtime-collab.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +11 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/registry.d.ts +118 -0
- package/dist/workflows/registry.d.ts.map +1 -0
- package/dist/workflows/registry.js +575 -0
- package/dist/workflows/registry.js.map +1 -0
- package/dist/workflows/types.d.ts +322 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +16 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import { BaseAgent } from "./base-agent.js";
|
|
3
|
+
import { AgentType } from "./types.js";
|
|
4
|
+
class TesterAgent extends BaseAgent {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({
|
|
7
|
+
type: AgentType.TESTER,
|
|
8
|
+
taskTimeout: 18e4,
|
|
9
|
+
// 3 minutes
|
|
10
|
+
capabilities: ["test-generation", "coverage-analysis"],
|
|
11
|
+
...config
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
// ==========================================================================
|
|
15
|
+
// Task Execution
|
|
16
|
+
// ==========================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Execute tester task
|
|
19
|
+
*/
|
|
20
|
+
async executeTask(task) {
|
|
21
|
+
const startTime = /* @__PURE__ */ new Date();
|
|
22
|
+
const taskType = task.input?.parameters?.taskType || "generate";
|
|
23
|
+
switch (taskType) {
|
|
24
|
+
case "generate":
|
|
25
|
+
return this.handleGenerateTask(task, startTime);
|
|
26
|
+
case "coverage":
|
|
27
|
+
return this.handleCoverageTask(task, startTime);
|
|
28
|
+
case "suggest":
|
|
29
|
+
return this.handleSuggestTask(task, startTime);
|
|
30
|
+
case "analyze":
|
|
31
|
+
return this.handleAnalyzeTask(task, startTime);
|
|
32
|
+
default:
|
|
33
|
+
return this.createErrorResult(
|
|
34
|
+
"INVALID_TASK_TYPE",
|
|
35
|
+
`Unknown task type: ${taskType}`,
|
|
36
|
+
startTime
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// ==========================================================================
|
|
41
|
+
// Public Methods
|
|
42
|
+
// ==========================================================================
|
|
43
|
+
/**
|
|
44
|
+
* Generate tests from source code
|
|
45
|
+
*/
|
|
46
|
+
async generateTests(request) {
|
|
47
|
+
this.logger.info("Generating tests", {
|
|
48
|
+
file: request.sourcePath,
|
|
49
|
+
framework: request.framework
|
|
50
|
+
});
|
|
51
|
+
const analysis = this.analyzeSourceCode(request.sourceCode);
|
|
52
|
+
const testCases = [];
|
|
53
|
+
for (const func of analysis.functions) {
|
|
54
|
+
testCases.push(...this.generateFunctionTests(func, request));
|
|
55
|
+
}
|
|
56
|
+
for (const cls of analysis.classes) {
|
|
57
|
+
testCases.push(...this.generateClassTests(cls, request));
|
|
58
|
+
}
|
|
59
|
+
if (request.includeEdgeCases) {
|
|
60
|
+
testCases.push(...this.generateEdgeCaseTests(analysis, request));
|
|
61
|
+
}
|
|
62
|
+
if (request.includeErrorCases) {
|
|
63
|
+
testCases.push(...this.generateErrorCaseTests(analysis, request));
|
|
64
|
+
}
|
|
65
|
+
return this.buildTestSuite(testCases, request);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Analyze test coverage
|
|
69
|
+
*/
|
|
70
|
+
async analyzeTestCoverage(sourceCode, sourcePath, testCode) {
|
|
71
|
+
this.logger.info("Analyzing test coverage", { file: sourcePath });
|
|
72
|
+
const analysis = this.analyzeSourceCode(sourceCode);
|
|
73
|
+
const gaps = [];
|
|
74
|
+
const recommendations = [];
|
|
75
|
+
let testedFunctions = 0;
|
|
76
|
+
let testedBranches = 0;
|
|
77
|
+
let testedLines = 0;
|
|
78
|
+
if (testCode) {
|
|
79
|
+
for (const func of analysis.functions) {
|
|
80
|
+
if (testCode.includes(func.name) || testCode.includes(`'${func.name}'`)) {
|
|
81
|
+
testedFunctions++;
|
|
82
|
+
} else {
|
|
83
|
+
gaps.push({
|
|
84
|
+
type: "function",
|
|
85
|
+
location: { start: func.line, end: func.line },
|
|
86
|
+
description: `Function '${func.name}' is not tested`,
|
|
87
|
+
priority: 8,
|
|
88
|
+
suggestedTest: this.generateTestStub(func.name, "function")
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const branch of analysis.branches) {
|
|
93
|
+
if (testCode.includes(branch.condition)) {
|
|
94
|
+
testedBranches++;
|
|
95
|
+
} else {
|
|
96
|
+
gaps.push({
|
|
97
|
+
type: "branch",
|
|
98
|
+
location: { start: branch.line, end: branch.line },
|
|
99
|
+
description: `Branch '${branch.type}' at line ${branch.line} needs testing`,
|
|
100
|
+
priority: 6
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
testedLines = Math.min(
|
|
105
|
+
analysis.lines,
|
|
106
|
+
Math.round(testedFunctions / Math.max(1, analysis.functions.length) * analysis.lines)
|
|
107
|
+
);
|
|
108
|
+
} else {
|
|
109
|
+
for (const func of analysis.functions) {
|
|
110
|
+
gaps.push({
|
|
111
|
+
type: "function",
|
|
112
|
+
location: { start: func.line, end: func.line },
|
|
113
|
+
description: `Function '${func.name}' is not tested`,
|
|
114
|
+
priority: 8,
|
|
115
|
+
suggestedTest: this.generateTestStub(func.name, "function")
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
recommendations.push("Create a test file for this source file");
|
|
119
|
+
}
|
|
120
|
+
const metrics = {
|
|
121
|
+
lines: analysis.lines > 0 ? Math.round(testedLines / analysis.lines * 100) : 0,
|
|
122
|
+
branches: analysis.branches.length > 0 ? Math.round(testedBranches / analysis.branches.length * 100) : 100,
|
|
123
|
+
functions: analysis.functions.length > 0 ? Math.round(testedFunctions / analysis.functions.length * 100) : 100,
|
|
124
|
+
statements: analysis.lines > 0 ? Math.round(testedLines / analysis.lines * 100) : 0,
|
|
125
|
+
uncoveredLines: [],
|
|
126
|
+
uncoveredFunctions: analysis.functions.filter((f) => !testCode?.includes(f.name)).map((f) => f.name)
|
|
127
|
+
};
|
|
128
|
+
if (metrics.functions < 80) {
|
|
129
|
+
recommendations.push(
|
|
130
|
+
`Increase function coverage from ${metrics.functions}% to at least 80%`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
if (metrics.branches < 70) {
|
|
134
|
+
recommendations.push(
|
|
135
|
+
`Improve branch coverage from ${metrics.branches}% to at least 70%`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
if (gaps.length > 0) {
|
|
139
|
+
recommendations.push(
|
|
140
|
+
`Address ${gaps.length} coverage gap(s) identified`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
sourceFile: sourcePath,
|
|
145
|
+
testFile: testCode ? sourcePath.replace(/\.ts$/, ".test.ts") : void 0,
|
|
146
|
+
metrics,
|
|
147
|
+
gaps: gaps.sort((a, b) => b.priority - a.priority),
|
|
148
|
+
recommendations
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Suggest test improvements
|
|
153
|
+
*/
|
|
154
|
+
async suggestTestCases(sourceCode, testCode, sourcePath) {
|
|
155
|
+
this.logger.info("Analyzing tests for improvements", { file: sourcePath });
|
|
156
|
+
const suggestions = [];
|
|
157
|
+
const sourceAnalysis = this.analyzeSourceCode(sourceCode);
|
|
158
|
+
const testAnalysis = this.analyzeTestCode(testCode);
|
|
159
|
+
for (const func of sourceAnalysis.functions) {
|
|
160
|
+
const hasTest = testAnalysis.testedItems.includes(func.name);
|
|
161
|
+
if (!hasTest) {
|
|
162
|
+
suggestions.push({
|
|
163
|
+
type: "add",
|
|
164
|
+
target: func.name,
|
|
165
|
+
description: `Add tests for function '${func.name}'`,
|
|
166
|
+
priority: 8,
|
|
167
|
+
sampleCode: this.generateTestStub(func.name, "function")
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
for (const func of sourceAnalysis.functions) {
|
|
172
|
+
const hasEdgeTests = testAnalysis.edgeCases.some(
|
|
173
|
+
(ec) => ec.includes(func.name)
|
|
174
|
+
);
|
|
175
|
+
if (!hasEdgeTests && func.hasParameters) {
|
|
176
|
+
suggestions.push({
|
|
177
|
+
type: "add",
|
|
178
|
+
target: func.name,
|
|
179
|
+
description: `Add edge case tests for '${func.name}' (null, undefined, empty values)`,
|
|
180
|
+
priority: 6,
|
|
181
|
+
sampleCode: this.generateEdgeCaseStub(func.name)
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
for (const func of sourceAnalysis.functions) {
|
|
186
|
+
const hasErrorTests = testAnalysis.errorTests.some(
|
|
187
|
+
(et) => et.includes(func.name)
|
|
188
|
+
);
|
|
189
|
+
if (!hasErrorTests && func.hasErrorHandling) {
|
|
190
|
+
suggestions.push({
|
|
191
|
+
type: "add",
|
|
192
|
+
target: func.name,
|
|
193
|
+
description: `Add error handling tests for '${func.name}'`,
|
|
194
|
+
priority: 7,
|
|
195
|
+
sampleCode: this.generateErrorTestStub(func.name)
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
for (const test of testAnalysis.tests) {
|
|
200
|
+
if (test.assertions === 0) {
|
|
201
|
+
suggestions.push({
|
|
202
|
+
type: "improve",
|
|
203
|
+
target: test.name,
|
|
204
|
+
description: `Test '${test.name}' has no assertions`,
|
|
205
|
+
priority: 9
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (test.assertions === 1) {
|
|
209
|
+
suggestions.push({
|
|
210
|
+
type: "improve",
|
|
211
|
+
target: test.name,
|
|
212
|
+
description: `Consider adding more assertions to '${test.name}'`,
|
|
213
|
+
priority: 4
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const testNames = testAnalysis.tests.map((t) => t.name);
|
|
218
|
+
const duplicates = testNames.filter(
|
|
219
|
+
(name, index) => testNames.indexOf(name) !== index
|
|
220
|
+
);
|
|
221
|
+
for (const dup of [...new Set(duplicates)]) {
|
|
222
|
+
suggestions.push({
|
|
223
|
+
type: "remove",
|
|
224
|
+
target: dup,
|
|
225
|
+
description: `Remove duplicate test '${dup}'`,
|
|
226
|
+
priority: 5
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return suggestions.sort((a, b) => b.priority - a.priority);
|
|
230
|
+
}
|
|
231
|
+
// ==========================================================================
|
|
232
|
+
// Private Task Handlers
|
|
233
|
+
// ==========================================================================
|
|
234
|
+
async handleGenerateTask(task, startTime) {
|
|
235
|
+
const request = task.input?.data;
|
|
236
|
+
if (!request?.sourceCode) {
|
|
237
|
+
return this.createErrorResult(
|
|
238
|
+
"VALIDATION_ERROR",
|
|
239
|
+
"Test generation request with source code is required",
|
|
240
|
+
startTime
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
const suite = await this.generateTests(request);
|
|
245
|
+
const artifacts = [{
|
|
246
|
+
type: "code",
|
|
247
|
+
name: path.basename(suite.path),
|
|
248
|
+
content: suite.code,
|
|
249
|
+
mimeType: "text/typescript"
|
|
250
|
+
}];
|
|
251
|
+
return this.createSuccessResult(suite, startTime, artifacts);
|
|
252
|
+
} catch (error) {
|
|
253
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
254
|
+
return this.createErrorResult("GENERATION_ERROR", `Test generation failed: ${message}`, startTime);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async handleCoverageTask(task, startTime) {
|
|
258
|
+
const input = task.input?.data;
|
|
259
|
+
if (!input?.sourceCode) {
|
|
260
|
+
return this.createErrorResult(
|
|
261
|
+
"VALIDATION_ERROR",
|
|
262
|
+
"Source code and path are required for coverage analysis",
|
|
263
|
+
startTime
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
const analysis = await this.analyzeTestCoverage(
|
|
268
|
+
input.sourceCode,
|
|
269
|
+
input.sourcePath,
|
|
270
|
+
input.testCode
|
|
271
|
+
);
|
|
272
|
+
return this.createSuccessResult(analysis, startTime);
|
|
273
|
+
} catch (error) {
|
|
274
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
275
|
+
return this.createErrorResult("COVERAGE_ERROR", `Coverage analysis failed: ${message}`, startTime);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
async handleSuggestTask(task, startTime) {
|
|
279
|
+
const input = task.input?.data;
|
|
280
|
+
if (!input?.sourceCode || !input?.testCode) {
|
|
281
|
+
return this.createErrorResult(
|
|
282
|
+
"VALIDATION_ERROR",
|
|
283
|
+
"Source code and test code are required",
|
|
284
|
+
startTime
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
const suggestions = await this.suggestTestCases(
|
|
289
|
+
input.sourceCode,
|
|
290
|
+
input.testCode,
|
|
291
|
+
input.sourcePath
|
|
292
|
+
);
|
|
293
|
+
return this.createSuccessResult(suggestions, startTime);
|
|
294
|
+
} catch (error) {
|
|
295
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
296
|
+
return this.createErrorResult("SUGGESTION_ERROR", `Test suggestion failed: ${message}`, startTime);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
async handleAnalyzeTask(task, startTime) {
|
|
300
|
+
const input = task.input?.data;
|
|
301
|
+
if (!input?.sourceCode) {
|
|
302
|
+
return this.createErrorResult(
|
|
303
|
+
"VALIDATION_ERROR",
|
|
304
|
+
"Source code is required for analysis",
|
|
305
|
+
startTime
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
const coverage = await this.analyzeTestCoverage(
|
|
310
|
+
input.sourceCode,
|
|
311
|
+
input.sourcePath,
|
|
312
|
+
input.testCode
|
|
313
|
+
);
|
|
314
|
+
const suggestions = input.testCode ? await this.suggestTestCases(input.sourceCode, input.testCode, input.sourcePath) : [];
|
|
315
|
+
return this.createSuccessResult({ coverage, suggestions }, startTime);
|
|
316
|
+
} catch (error) {
|
|
317
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
318
|
+
return this.createErrorResult("ANALYSIS_ERROR", `Test analysis failed: ${message}`, startTime);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// ==========================================================================
|
|
322
|
+
// Source Code Analysis
|
|
323
|
+
// ==========================================================================
|
|
324
|
+
analyzeSourceCode(code) {
|
|
325
|
+
const lines = code.split("\n");
|
|
326
|
+
const functions = [];
|
|
327
|
+
const classes = [];
|
|
328
|
+
const branches = [];
|
|
329
|
+
const funcRegex = /(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)/g;
|
|
330
|
+
const arrowRegex = /(?:export\s+)?(?:const|let)\s+(\w+)\s*=\s*(?:async\s+)?\(([^)]*)\)\s*=>/g;
|
|
331
|
+
const methodRegex = /(?:async\s+)?(\w+)\s*\(([^)]*)\)\s*(?::\s*[^{]+)?\s*\{/g;
|
|
332
|
+
let match;
|
|
333
|
+
while ((match = funcRegex.exec(code)) !== null) {
|
|
334
|
+
const lineNum = code.slice(0, match.index).split("\n").length;
|
|
335
|
+
const params = match[2].split(",").map((p) => p.trim()).filter((p) => p);
|
|
336
|
+
const funcBody = this.extractFunctionBody(code, match.index);
|
|
337
|
+
functions.push({
|
|
338
|
+
name: match[1],
|
|
339
|
+
line: lineNum,
|
|
340
|
+
params,
|
|
341
|
+
hasParameters: params.length > 0,
|
|
342
|
+
hasErrorHandling: /try\s*\{/.test(funcBody),
|
|
343
|
+
isAsync: match[0].includes("async")
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
while ((match = arrowRegex.exec(code)) !== null) {
|
|
347
|
+
const lineNum = code.slice(0, match.index).split("\n").length;
|
|
348
|
+
const params = match[2].split(",").map((p) => p.trim()).filter((p) => p);
|
|
349
|
+
const funcBody = this.extractFunctionBody(code, match.index);
|
|
350
|
+
functions.push({
|
|
351
|
+
name: match[1],
|
|
352
|
+
line: lineNum,
|
|
353
|
+
params,
|
|
354
|
+
hasParameters: params.length > 0,
|
|
355
|
+
hasErrorHandling: /try\s*\{/.test(funcBody),
|
|
356
|
+
isAsync: match[0].includes("async")
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
const classRegex = /(?:export\s+)?class\s+(\w+)/g;
|
|
360
|
+
while ((match = classRegex.exec(code)) !== null) {
|
|
361
|
+
const lineNum = code.slice(0, match.index).split("\n").length;
|
|
362
|
+
const classBody = this.extractClassBody(code, match.index);
|
|
363
|
+
const methods = [];
|
|
364
|
+
let methodMatch;
|
|
365
|
+
while ((methodMatch = methodRegex.exec(classBody)) !== null) {
|
|
366
|
+
if (!["constructor", "if", "while", "for", "switch"].includes(methodMatch[1])) {
|
|
367
|
+
methods.push(methodMatch[1]);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
classes.push({
|
|
371
|
+
name: match[1],
|
|
372
|
+
line: lineNum,
|
|
373
|
+
methods
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
const ifRegex = /if\s*\(([^)]+)\)/g;
|
|
377
|
+
while ((match = ifRegex.exec(code)) !== null) {
|
|
378
|
+
const lineNum = code.slice(0, match.index).split("\n").length;
|
|
379
|
+
branches.push({
|
|
380
|
+
type: "if",
|
|
381
|
+
line: lineNum,
|
|
382
|
+
condition: match[1]
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
const switchRegex = /switch\s*\(([^)]+)\)/g;
|
|
386
|
+
while ((match = switchRegex.exec(code)) !== null) {
|
|
387
|
+
const lineNum = code.slice(0, match.index).split("\n").length;
|
|
388
|
+
branches.push({
|
|
389
|
+
type: "switch",
|
|
390
|
+
line: lineNum,
|
|
391
|
+
condition: match[1]
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
functions,
|
|
396
|
+
classes,
|
|
397
|
+
branches,
|
|
398
|
+
lines: lines.filter((l) => l.trim().length > 0).length
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
analyzeTestCode(code) {
|
|
402
|
+
const tests = [];
|
|
403
|
+
const testedItems = [];
|
|
404
|
+
const edgeCases = [];
|
|
405
|
+
const errorTests = [];
|
|
406
|
+
const testRegex = /(?:it|test)\s*\(\s*['"`]([^'"`]+)['"`]/g;
|
|
407
|
+
let match;
|
|
408
|
+
while ((match = testRegex.exec(code)) !== null) {
|
|
409
|
+
const testName = match[1];
|
|
410
|
+
const testBody = this.extractTestBody(code, match.index);
|
|
411
|
+
const assertions = (testBody.match(/expect\s*\(/g) || []).length;
|
|
412
|
+
tests.push({ name: testName, assertions });
|
|
413
|
+
const identifiers = testBody.match(/\b[a-zA-Z_]\w*\b/g) || [];
|
|
414
|
+
testedItems.push(...identifiers);
|
|
415
|
+
if (testName.toLowerCase().includes("edge") || testName.toLowerCase().includes("empty") || testName.toLowerCase().includes("null") || testName.toLowerCase().includes("undefined") || testBody.includes("null") || testBody.includes("undefined") || testBody.includes("[]") || testBody.includes("''")) {
|
|
416
|
+
edgeCases.push(testName);
|
|
417
|
+
}
|
|
418
|
+
if (testName.toLowerCase().includes("error") || testName.toLowerCase().includes("throw") || testName.toLowerCase().includes("fail") || testBody.includes("toThrow") || testBody.includes("rejects")) {
|
|
419
|
+
errorTests.push(testName);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return {
|
|
423
|
+
tests,
|
|
424
|
+
testedItems: [...new Set(testedItems)],
|
|
425
|
+
edgeCases,
|
|
426
|
+
errorTests
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
// ==========================================================================
|
|
430
|
+
// Test Generation Methods
|
|
431
|
+
// ==========================================================================
|
|
432
|
+
generateFunctionTests(func, request) {
|
|
433
|
+
const testCases = [];
|
|
434
|
+
testCases.push({
|
|
435
|
+
name: `should execute ${func.name} successfully`,
|
|
436
|
+
type: "unit",
|
|
437
|
+
category: "happy-path",
|
|
438
|
+
code: this.generateHappyPathTest(func),
|
|
439
|
+
assertions: ["expect(result).toBeDefined()"]
|
|
440
|
+
});
|
|
441
|
+
if (func.params.length > 0) {
|
|
442
|
+
for (const param of func.params) {
|
|
443
|
+
testCases.push({
|
|
444
|
+
name: `should handle ${param} parameter correctly`,
|
|
445
|
+
type: "unit",
|
|
446
|
+
category: "parameter-validation",
|
|
447
|
+
code: this.generateParamTest(func.name, param),
|
|
448
|
+
assertions: [`expect result for ${param}`]
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return testCases;
|
|
453
|
+
}
|
|
454
|
+
generateClassTests(cls, request) {
|
|
455
|
+
const testCases = [];
|
|
456
|
+
testCases.push({
|
|
457
|
+
name: `should create ${cls.name} instance`,
|
|
458
|
+
type: "unit",
|
|
459
|
+
category: "instantiation",
|
|
460
|
+
code: ` const instance = new ${cls.name}();
|
|
461
|
+
expect(instance).toBeInstanceOf(${cls.name});`,
|
|
462
|
+
setup: `let instance: ${cls.name};`,
|
|
463
|
+
assertions: [`expect(instance).toBeInstanceOf(${cls.name})`]
|
|
464
|
+
});
|
|
465
|
+
for (const method of cls.methods) {
|
|
466
|
+
testCases.push({
|
|
467
|
+
name: `should call ${method} method`,
|
|
468
|
+
type: "unit",
|
|
469
|
+
category: "method",
|
|
470
|
+
code: this.generateMethodTest(cls.name, method),
|
|
471
|
+
assertions: [`expect(result).toBeDefined()`]
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
return testCases;
|
|
475
|
+
}
|
|
476
|
+
generateEdgeCaseTests(analysis, request) {
|
|
477
|
+
const testCases = [];
|
|
478
|
+
for (const func of analysis.functions) {
|
|
479
|
+
if (func.hasParameters) {
|
|
480
|
+
testCases.push({
|
|
481
|
+
name: `should handle null input for ${func.name}`,
|
|
482
|
+
type: "unit",
|
|
483
|
+
category: "edge-case",
|
|
484
|
+
code: this.generateNullTest(func.name),
|
|
485
|
+
assertions: ["expect behavior with null"]
|
|
486
|
+
});
|
|
487
|
+
testCases.push({
|
|
488
|
+
name: `should handle empty input for ${func.name}`,
|
|
489
|
+
type: "unit",
|
|
490
|
+
category: "edge-case",
|
|
491
|
+
code: this.generateEmptyTest(func.name),
|
|
492
|
+
assertions: ["expect behavior with empty"]
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return testCases;
|
|
497
|
+
}
|
|
498
|
+
generateErrorCaseTests(analysis, request) {
|
|
499
|
+
const testCases = [];
|
|
500
|
+
for (const func of analysis.functions) {
|
|
501
|
+
if (func.hasErrorHandling) {
|
|
502
|
+
testCases.push({
|
|
503
|
+
name: `should handle errors in ${func.name}`,
|
|
504
|
+
type: "unit",
|
|
505
|
+
category: "error-handling",
|
|
506
|
+
code: this.generateErrorTest(func.name, func.isAsync),
|
|
507
|
+
assertions: ["expect error handling"]
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return testCases;
|
|
512
|
+
}
|
|
513
|
+
// ==========================================================================
|
|
514
|
+
// Test Code Generation Helpers
|
|
515
|
+
// ==========================================================================
|
|
516
|
+
generateHappyPathTest(func) {
|
|
517
|
+
if (func.isAsync) {
|
|
518
|
+
return ` const result = await ${func.name}();
|
|
519
|
+
expect(result).toBeDefined();`;
|
|
520
|
+
}
|
|
521
|
+
return ` const result = ${func.name}();
|
|
522
|
+
expect(result).toBeDefined();`;
|
|
523
|
+
}
|
|
524
|
+
generateParamTest(funcName, param) {
|
|
525
|
+
return ` const testValue = 'test-${param}';
|
|
526
|
+
const result = ${funcName}(testValue);
|
|
527
|
+
expect(result).toBeDefined();`;
|
|
528
|
+
}
|
|
529
|
+
generateMethodTest(className, method) {
|
|
530
|
+
return ` const instance = new ${className}();
|
|
531
|
+
const result = instance.${method}();
|
|
532
|
+
expect(result).toBeDefined();`;
|
|
533
|
+
}
|
|
534
|
+
generateNullTest(funcName) {
|
|
535
|
+
return ` expect(() => ${funcName}(null)).not.toThrow();`;
|
|
536
|
+
}
|
|
537
|
+
generateEmptyTest(funcName) {
|
|
538
|
+
return ` const result = ${funcName}('');
|
|
539
|
+
expect(result).toBeDefined();`;
|
|
540
|
+
}
|
|
541
|
+
generateErrorTest(funcName, isAsync) {
|
|
542
|
+
if (isAsync) {
|
|
543
|
+
return ` await expect(${funcName}(invalidInput)).rejects.toThrow();`;
|
|
544
|
+
}
|
|
545
|
+
return ` expect(() => ${funcName}(invalidInput)).toThrow();`;
|
|
546
|
+
}
|
|
547
|
+
generateTestStub(name, type) {
|
|
548
|
+
if (type === "function") {
|
|
549
|
+
return ` it('should test ${name}', () => {
|
|
550
|
+
const result = ${name}();
|
|
551
|
+
expect(result).toBeDefined();
|
|
552
|
+
});`;
|
|
553
|
+
}
|
|
554
|
+
return ` it('should create ${name} instance', () => {
|
|
555
|
+
const instance = new ${name}();
|
|
556
|
+
expect(instance).toBeInstanceOf(${name});
|
|
557
|
+
});`;
|
|
558
|
+
}
|
|
559
|
+
generateEdgeCaseStub(funcName) {
|
|
560
|
+
return ` it('should handle edge cases for ${funcName}', () => {
|
|
561
|
+
expect(${funcName}(null)).toBeDefined();
|
|
562
|
+
expect(${funcName}(undefined)).toBeDefined();
|
|
563
|
+
expect(${funcName}('')).toBeDefined();
|
|
564
|
+
});`;
|
|
565
|
+
}
|
|
566
|
+
generateErrorTestStub(funcName) {
|
|
567
|
+
return ` it('should handle errors in ${funcName}', () => {
|
|
568
|
+
expect(() => ${funcName}(invalidInput)).toThrow();
|
|
569
|
+
});`;
|
|
570
|
+
}
|
|
571
|
+
// ==========================================================================
|
|
572
|
+
// Test Suite Building
|
|
573
|
+
// ==========================================================================
|
|
574
|
+
buildTestSuite(testCases, request) {
|
|
575
|
+
request.framework === "vitest";
|
|
576
|
+
const moduleName = path.basename(request.sourcePath, path.extname(request.sourcePath));
|
|
577
|
+
const imports = this.buildImports(request, moduleName);
|
|
578
|
+
let code = "";
|
|
579
|
+
code += imports.join("\n") + "\n\n";
|
|
580
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
581
|
+
for (const test of testCases) {
|
|
582
|
+
if (!byCategory.has(test.category)) {
|
|
583
|
+
byCategory.set(test.category, []);
|
|
584
|
+
}
|
|
585
|
+
byCategory.get(test.category).push(test);
|
|
586
|
+
}
|
|
587
|
+
code += `describe('${moduleName}', () => {
|
|
588
|
+
`;
|
|
589
|
+
for (const [category, tests] of byCategory) {
|
|
590
|
+
code += ` describe('${category}', () => {
|
|
591
|
+
`;
|
|
592
|
+
for (const test of tests) {
|
|
593
|
+
if (test.setup) {
|
|
594
|
+
code += ` ${test.setup}
|
|
595
|
+
|
|
596
|
+
`;
|
|
597
|
+
}
|
|
598
|
+
code += ` it('${test.name}', ${test.code.includes("await") ? "async " : ""}() => {
|
|
599
|
+
`;
|
|
600
|
+
code += test.code.split("\n").map((l) => ` ${l}`).join("\n") + "\n";
|
|
601
|
+
code += ` });
|
|
602
|
+
|
|
603
|
+
`;
|
|
604
|
+
}
|
|
605
|
+
code += ` });
|
|
606
|
+
|
|
607
|
+
`;
|
|
608
|
+
}
|
|
609
|
+
code += "});\n";
|
|
610
|
+
const estimatedCoverage = Math.min(
|
|
611
|
+
100,
|
|
612
|
+
Math.round(testCases.length / Math.max(1, testCases.length) * 80)
|
|
613
|
+
);
|
|
614
|
+
return {
|
|
615
|
+
code,
|
|
616
|
+
path: request.sourcePath.replace(/\.(ts|tsx|js|jsx)$/, `.test.$1`),
|
|
617
|
+
testCount: testCases.length,
|
|
618
|
+
estimatedCoverage,
|
|
619
|
+
categories: [...byCategory.keys()],
|
|
620
|
+
imports
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
buildImports(request, moduleName) {
|
|
624
|
+
const imports = [];
|
|
625
|
+
const isVitest = request.framework === "vitest";
|
|
626
|
+
if (isVitest) {
|
|
627
|
+
imports.push("import { describe, it, expect, beforeEach, afterEach } from 'vitest';");
|
|
628
|
+
} else {
|
|
629
|
+
imports.push("import { describe, it, expect, beforeEach, afterEach } from '@jest/globals';");
|
|
630
|
+
}
|
|
631
|
+
imports.push(`import { /* exports */ } from './${moduleName}';`);
|
|
632
|
+
return imports;
|
|
633
|
+
}
|
|
634
|
+
// ==========================================================================
|
|
635
|
+
// Utility Methods
|
|
636
|
+
// ==========================================================================
|
|
637
|
+
extractFunctionBody(code, startIndex) {
|
|
638
|
+
let braceCount = 0;
|
|
639
|
+
let inBody = false;
|
|
640
|
+
let bodyStart = startIndex;
|
|
641
|
+
let bodyEnd = startIndex;
|
|
642
|
+
for (let i = startIndex; i < code.length; i++) {
|
|
643
|
+
if (code[i] === "{") {
|
|
644
|
+
if (!inBody) {
|
|
645
|
+
bodyStart = i;
|
|
646
|
+
inBody = true;
|
|
647
|
+
}
|
|
648
|
+
braceCount++;
|
|
649
|
+
} else if (code[i] === "}") {
|
|
650
|
+
braceCount--;
|
|
651
|
+
if (inBody && braceCount === 0) {
|
|
652
|
+
bodyEnd = i + 1;
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return code.slice(bodyStart, bodyEnd);
|
|
658
|
+
}
|
|
659
|
+
extractClassBody(code, startIndex) {
|
|
660
|
+
return this.extractFunctionBody(code, startIndex);
|
|
661
|
+
}
|
|
662
|
+
extractTestBody(code, startIndex) {
|
|
663
|
+
let parenCount = 0;
|
|
664
|
+
let inTest = false;
|
|
665
|
+
let bodyStart = startIndex;
|
|
666
|
+
for (let i = startIndex; i < code.length; i++) {
|
|
667
|
+
if (code[i] === "(") {
|
|
668
|
+
parenCount++;
|
|
669
|
+
inTest = true;
|
|
670
|
+
} else if (code[i] === ")") {
|
|
671
|
+
parenCount--;
|
|
672
|
+
if (inTest && parenCount === 0) {
|
|
673
|
+
return code.slice(bodyStart, i + 1);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
return code.slice(bodyStart, Math.min(bodyStart + 500, code.length));
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
export {
|
|
681
|
+
TesterAgent
|
|
682
|
+
};
|
|
683
|
+
//# sourceMappingURL=tester-agent.js.map
|