@task-shepherd/agent 1.0.2

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.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Schema validation test for requirements extraction
4
+ * Quick test to validate the new schemas work correctly
5
+ */
6
+ export {};
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Schema validation test for requirements extraction
4
+ * Quick test to validate the new schemas work correctly
5
+ */
6
+ import { ExplicitRequirementSchema, InferredRequirementSchema, NonFunctionalRequirementSchema, ClarificationQuestionSchema, SuggestedProductRequirementsSchema } from './types.js';
7
+ // Test data for schema validation
8
+ const testExplicitRequirement = {
9
+ requirement: "User authentication and login system",
10
+ source_text: "users need to be able to log in and create accounts",
11
+ confidence: "high"
12
+ };
13
+ const testInferredRequirement = {
14
+ requirement: "Real-time notifications for task updates",
15
+ rationale: "Critical for remote teams to stay synchronized",
16
+ domain_pattern: "task-management-standard",
17
+ priority: "high"
18
+ };
19
+ const testNonFunctionalRequirement = {
20
+ category: "security",
21
+ requirement: "Multi-factor authentication support",
22
+ industry_standard: true,
23
+ customization_needed: false
24
+ };
25
+ const testClarificationQuestion = {
26
+ category: "scalability",
27
+ question: "What is the expected number of concurrent users?",
28
+ impact_if_unclear: "Affects database scaling and infrastructure decisions",
29
+ suggested_default: "Design for 50 users per organization"
30
+ };
31
+ const testSuggestedProductRequirements = {
32
+ explicit_requirements: [testExplicitRequirement],
33
+ inferred_functional_requirements: [testInferredRequirement],
34
+ suggested_non_functional_requirements: [testNonFunctionalRequirement],
35
+ requirements_clarification_questions: [testClarificationQuestion]
36
+ };
37
+ // Run validation tests
38
+ function runSchemaTests() {
39
+ console.log('๐Ÿงช Running schema validation tests...\n');
40
+ try {
41
+ // Test ExplicitRequirementSchema
42
+ console.log('Testing ExplicitRequirementSchema...');
43
+ const validExplicit = ExplicitRequirementSchema.parse(testExplicitRequirement);
44
+ console.log('โœ… ExplicitRequirementSchema validation passed');
45
+ // Test InferredRequirementSchema
46
+ console.log('Testing InferredRequirementSchema...');
47
+ const validInferred = InferredRequirementSchema.parse(testInferredRequirement);
48
+ console.log('โœ… InferredRequirementSchema validation passed');
49
+ // Test NonFunctionalRequirementSchema
50
+ console.log('Testing NonFunctionalRequirementSchema...');
51
+ const validNonFunctional = NonFunctionalRequirementSchema.parse(testNonFunctionalRequirement);
52
+ console.log('โœ… NonFunctionalRequirementSchema validation passed');
53
+ // Test ClarificationQuestionSchema
54
+ console.log('Testing ClarificationQuestionSchema...');
55
+ const validClarification = ClarificationQuestionSchema.parse(testClarificationQuestion);
56
+ console.log('โœ… ClarificationQuestionSchema validation passed');
57
+ // Test SuggestedProductRequirementsSchema
58
+ console.log('Testing SuggestedProductRequirementsSchema...');
59
+ const validRequirements = SuggestedProductRequirementsSchema.parse(testSuggestedProductRequirements);
60
+ console.log('โœ… SuggestedProductRequirementsSchema validation passed');
61
+ console.log('\n๐ŸŽ‰ All schema validation tests passed!');
62
+ // Test invalid data
63
+ console.log('\n๐Ÿ” Testing invalid data handling...');
64
+ try {
65
+ ExplicitRequirementSchema.parse({
66
+ requirement: "Test",
67
+ source_text: "Test",
68
+ confidence: "invalid" // Should fail
69
+ });
70
+ console.log('โŒ Should have failed validation for invalid confidence level');
71
+ }
72
+ catch (error) {
73
+ console.log('โœ… Correctly rejected invalid confidence level');
74
+ }
75
+ try {
76
+ InferredRequirementSchema.parse({
77
+ requirement: "Test",
78
+ rationale: "Test",
79
+ domain_pattern: "Test"
80
+ // Missing priority - should fail
81
+ });
82
+ console.log('โŒ Should have failed validation for missing priority');
83
+ }
84
+ catch (error) {
85
+ console.log('โœ… Correctly rejected missing required field');
86
+ }
87
+ console.log('\nโœจ All validation tests completed successfully!');
88
+ }
89
+ catch (error) {
90
+ console.error('โŒ Schema validation failed:', error);
91
+ process.exit(1);
92
+ }
93
+ }
94
+ // Run the tests
95
+ runSchemaTests();