fraim-framework 2.0.3 โ†’ 2.0.4

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,62 @@
1
+ # Testing with FRAIM Framework
2
+
3
+ This directory contains example test cases that demonstrate how to use the FRAIM testing framework with proper tagging and structure.
4
+
5
+ ## Test Structure
6
+
7
+ The example test file (`example-test.ts`) demonstrates:
8
+
9
+ - **BaseTestCase Interface**: All test cases extend the `BaseTestCase` interface
10
+ - **Tagging System**: Tests are tagged with categories like `smoke`, `integration`, `performance`, etc.
11
+ - **Test Organization**: Tests are organized by functionality and complexity
12
+ - **Mock Functions**: Example mock functions for common scenarios
13
+
14
+ ## Recommended Test Tags (you can add others to your preference)
15
+
16
+ - **`smoke`**: Critical tests that must pass for basic functionality
17
+ - **`flaky`**: Tests that may be unreliable or environment-dependent
18
+ - **`failing`**: Tests that are currently failing and need debugging
19
+
20
+ ## Running Tests
21
+
22
+ ### Run All Tests
23
+ ```bash
24
+ npx run test example-test.ts
25
+ ```
26
+
27
+ ### Run Only Smoke Tests
28
+ ```bash
29
+ npx run test-smoke example-test.ts
30
+ ```
31
+
32
+ ### Run Only Flaky Tests
33
+ ```bash
34
+ npx run test-flkay *test*.ts
35
+ ```
36
+
37
+ ## Best Practices
38
+
39
+ 1. **Always use tags**: Tag your tests appropriately for easy filtering
40
+ 2. **Include descriptions**: Provide clear descriptions of what each test does
41
+ 3. **Use meaningful names**: Test names should clearly indicate what's being tested
42
+ 4. **Handle errors gracefully**: Catch and report errors appropriately
43
+ 5. **Use mocks for external dependencies**: Don't rely on external services in tests
44
+ 6. **Test both success and failure cases**: Ensure your tests cover edge cases
45
+
46
+ ## Integration with FRAIM
47
+
48
+ This testing framework integrates with FRAIM's agent coordination system:
49
+
50
+ - **AI Agents**: Use these tests during implementation phase
51
+ - **CI/CD**: Automated test execution with proper tagging
52
+ - **Evidence Collection**: Test results are collected as evidence for reviews
53
+
54
+ ## Customization
55
+
56
+ To adapt this testing framework for your project:
57
+
58
+ 1. **Update mock functions**: Replace example mocks with your actual functions
59
+ 2. **Add project-specific tags**: Define tags relevant to your domain
60
+ 3. **Customize test structure**: Modify the test case interface as needed
61
+ 4. **Add setup/teardown**: Include any necessary test setup or cleanup
62
+ 5. **Configure CI integration**: Set up automated test execution in your CI pipeline
@@ -0,0 +1,186 @@
1
+ #!/usr/bin/env tsx
2
+
3
+ /**
4
+ * Example Test Case for FRAIM Framework
5
+ *
6
+ * This demonstrates how to write test cases using the FRAIM testing framework
7
+ * with proper tagging and structure.
8
+ */
9
+
10
+ import { BaseTestCase, runTests } from '../../test-utils';
11
+
12
+ // Example test case interface extending BaseTestCase
13
+ interface ExampleTestCase extends BaseTestCase {
14
+ description: string;
15
+ testFunction: () => Promise<boolean>;
16
+ }
17
+
18
+ // Example test cases with different tags
19
+ const EXAMPLE_TEST_CASES: ExampleTestCase[] = [
20
+ {
21
+ name: 'test_basic_functionality',
22
+ tags: ['smoke', 'basic'],
23
+ description: 'Should verify basic application functionality works',
24
+ testFunction: async () => {
25
+ console.log('๐Ÿงช Testing basic functionality...');
26
+
27
+ // Example: Test that a basic function works
28
+ const result = await basicFunction();
29
+
30
+ if (result !== 'success') {
31
+ console.log(`โŒ Expected 'success', got '${result}'`);
32
+ return false;
33
+ }
34
+
35
+ console.log('โœ… Basic functionality test passed');
36
+ return true;
37
+ }
38
+ },
39
+ {
40
+ name: 'test_user_authentication',
41
+ tags: ['smoke', 'auth'],
42
+ description: 'Should verify user authentication works correctly',
43
+ testFunction: async () => {
44
+ console.log('๐Ÿงช Testing user authentication...');
45
+
46
+ // Example: Test authentication flow
47
+ const authResult = await authenticateUser('test@example.com', 'password123');
48
+
49
+ if (!authResult.success) {
50
+ console.log(`โŒ Authentication failed: ${authResult.error}`);
51
+ return false;
52
+ }
53
+
54
+ console.log('โœ… User authentication test passed');
55
+ return true;
56
+ }
57
+ },
58
+ {
59
+ name: 'test_api_integration',
60
+ tags: ['integration', 'api'],
61
+ description: 'Should verify API integration works correctly',
62
+ testFunction: async () => {
63
+ console.log('๐Ÿงช Testing API integration...');
64
+
65
+ // Example: Test API call
66
+ const apiResult = await callExternalAPI('https://api.example.com/data');
67
+
68
+ if (!apiResult || !apiResult.data) {
69
+ console.log('โŒ API integration failed - no data returned');
70
+ return false;
71
+ }
72
+
73
+ console.log('โœ… API integration test passed');
74
+ return true;
75
+ }
76
+ },
77
+ {
78
+ name: 'test_database_operations',
79
+ tags: ['database', 'integration'],
80
+ description: 'Should verify database operations work correctly',
81
+ testFunction: async () => {
82
+ console.log('๐Ÿงช Testing database operations...');
83
+
84
+ // Example: Test database operations
85
+ const dbResult = await performDatabaseOperation();
86
+
87
+ if (!dbResult.success) {
88
+ console.log(`โŒ Database operation failed: ${dbResult.error}`);
89
+ return false;
90
+ }
91
+
92
+ console.log('โœ… Database operations test passed');
93
+ return true;
94
+ }
95
+ },
96
+ {
97
+ name: 'test_performance_benchmark',
98
+ tags: ['performance', 'flaky'],
99
+ description: 'Should verify performance meets requirements (may be flaky)',
100
+ testFunction: async () => {
101
+ console.log('๐Ÿงช Testing performance benchmark...');
102
+
103
+ const startTime = Date.now();
104
+ await performExpensiveOperation();
105
+ const endTime = Date.now();
106
+
107
+ const duration = endTime - startTime;
108
+ const maxDuration = 1000; // 1 second
109
+
110
+ if (duration > maxDuration) {
111
+ console.log(`โŒ Performance test failed: ${duration}ms > ${maxDuration}ms`);
112
+ return false;
113
+ }
114
+
115
+ console.log(`โœ… Performance test passed: ${duration}ms`);
116
+ return true;
117
+ }
118
+ },
119
+ {
120
+ name: 'test_failing_scenario',
121
+ tags: ['failing', 'debug'],
122
+ description: 'This test is currently failing and needs debugging',
123
+ testFunction: async () => {
124
+ console.log('๐Ÿงช Testing failing scenario...');
125
+
126
+ // This test is intentionally failing to demonstrate the failing tag
127
+ console.log('โŒ This test is currently failing for demonstration');
128
+ return false;
129
+ }
130
+ }
131
+ ];
132
+
133
+ // Mock functions for demonstration
134
+ async function basicFunction(): Promise<string> {
135
+ // Simulate some work
136
+ await new Promise(resolve => setTimeout(resolve, 10));
137
+ return 'success';
138
+ }
139
+
140
+ async function authenticateUser(email: string, password: string): Promise<{success: boolean, error?: string}> {
141
+ // Simulate authentication
142
+ await new Promise(resolve => setTimeout(resolve, 50));
143
+
144
+ if (email === 'test@example.com' && password === 'password123') {
145
+ return { success: true };
146
+ }
147
+
148
+ return { success: false, error: 'Invalid credentials' };
149
+ }
150
+
151
+ async function callExternalAPI(url: string): Promise<{data?: any}> {
152
+ // Simulate API call
153
+ await new Promise(resolve => setTimeout(resolve, 100));
154
+
155
+ return {
156
+ data: {
157
+ id: 1,
158
+ name: 'Test Data',
159
+ timestamp: new Date().toISOString()
160
+ }
161
+ };
162
+ }
163
+
164
+ async function performDatabaseOperation(): Promise<{success: boolean, error?: string}> {
165
+ // Simulate database operation
166
+ await new Promise(resolve => setTimeout(resolve, 75));
167
+
168
+ return { success: true };
169
+ }
170
+
171
+ async function performExpensiveOperation(): Promise<void> {
172
+ // Simulate expensive operation
173
+ await new Promise(resolve => setTimeout(resolve, 500));
174
+ }
175
+
176
+ // Test runner function
177
+ const runExampleTest = async (testCase: ExampleTestCase): Promise<boolean> => {
178
+ try {
179
+ return await testCase.testFunction();
180
+ } catch (error) {
181
+ console.log(`โŒ Test ${testCase.name} threw an error: ${error}`);
182
+ return false;
183
+ }
184
+ };
185
+
186
+ await runTests(EXAMPLE_TEST_CASES, runExampleTest, 'Example Test Suite');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fraim-framework",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "FRAIM v2: Framework for Rigor-based AI Management - Transform from solo developer to AI manager orchestrating production-ready code with enterprise-grade discipline",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -49,6 +49,15 @@
49
49
  "tsx": "^4.0.0",
50
50
  "dotenv": "^16.0.0"
51
51
  },
52
+ "files": [
53
+ ".ai-agents/",
54
+ "examples/",
55
+ "bin/",
56
+ "*.js",
57
+ "*.ts",
58
+ "*.md",
59
+ "*.json"
60
+ ],
52
61
  "publishConfig": {
53
62
  "access": "public"
54
63
  }
@@ -1,8 +0,0 @@
1
- ---
2
- description: Centralized AI agent rules for Cursor
3
- alwaysApply: true
4
- ---
5
-
6
- # Cursor AI Agent Rules
7
-
8
- Thoroughly review `.ai-agents/agent-guardrails.md`
@@ -1,4 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
- Follow instructions in `.ai-agents/workflows/design.md`
@@ -1,6 +0,0 @@
1
- ---
2
-
3
- alwaysApply: false
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/implement.md`
@@ -1,5 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
-
5
- Follow instructions in `.ai-agents/workflows/resolve.md`
@@ -1,4 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
- Follow instructions in `.ai-agents/workflows/retrospect.md`
@@ -1,4 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
- Follow instructions in `.ai-agents/workflows/spec.md`
@@ -1,5 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
-
5
- Follow instructions in `.ai-agents/workflows/test.md`
@@ -1,7 +0,0 @@
1
- ---
2
- trigger: always_on
3
- ---
4
-
5
- # Windsurf AI Agent Rules
6
-
7
- Thoroughly review `.ai-agents/agent-guardrails.md`
@@ -1,6 +0,0 @@
1
- ---
2
- description: Resolve issue (once confirmed complete)
3
- auto_execution_mode: 3
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/resolve.md`
@@ -1,6 +0,0 @@
1
- ---
2
- description: Resolve issue (once confirmed complete)
3
- auto_execution_mode: 3
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/retrospect.md`
@@ -1,6 +0,0 @@
1
- ---
2
- description: Start working on the issue
3
- auto_execution_mode: 3
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/design.md`
@@ -1,6 +0,0 @@
1
- ---
2
- description: Implement issue
3
- auto_execution_mode: 3
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/implement.md`
@@ -1,6 +0,0 @@
1
- ---
2
- description: Spec Issue
3
- auto_execution_mode: 3
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/spec.md`
@@ -1,6 +0,0 @@
1
- ---
2
- description: Start writing tests
3
- auto_execution_mode: 3
4
- ---
5
-
6
- Follow instructions in `.ai-agents/workflows/test.md`
package/CODEOWNERS DELETED
@@ -1,24 +0,0 @@
1
- # This file defines the code owners for the FRAIM repository
2
- # Code owners are automatically requested for review when someone opens a PR that modifies code they own
3
- # See: https://docs.github.com/en/repositories/managing-your-codebase-in-github/about-code-owners
4
-
5
- # Default owners for everything in the repo
6
- * @mathursrus
7
-
8
- # Specific ownership for different parts of the codebase
9
- /agents/ @mathursrus
10
- /rules/ @mathursrus
11
- /workflows/ @mathursrus
12
- /templates/ @mathursrus
13
- /scripts/ @mathursrus
14
- /.github/ @mathursrus
15
-
16
- # Documentation
17
- /docs/ @mathursrus
18
- *.md @mathursrus
19
-
20
- # Configuration files
21
- *.json @mathursrus
22
- *.jsonc @mathursrus
23
- *.yml @mathursrus
24
- *.yaml @mathursrus
package/install.sh DELETED
@@ -1,58 +0,0 @@
1
- #!/bin/bash
2
-
3
- # FRAIM One-Line Installer
4
- # Framework for Rigor-based AI Management
5
- # Where humans become AI managers through rigorous methodology
6
-
7
- set -e
8
-
9
- # Colors for output
10
- RED='\033[0;31m'
11
- GREEN='\033[0;32m'
12
- YELLOW='\033[1;33m'
13
- BLUE='\033[0;34m'
14
- NC='\033[0m' # No Color
15
-
16
- # Banner
17
- echo -e "${BLUE}"
18
- cat << 'EOF'
19
- โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
20
- โ•‘ ๐Ÿš€ FRAIM โ•‘
21
- โ•‘ Framework for Rigor-based AI Management โ•‘
22
- โ•‘ Where humans become AI managers โ•‘
23
- โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
24
- EOF
25
- echo -e "${NC}"
26
-
27
- echo -e "${GREEN}๐Ÿค– Welcome to FRAIM!${NC}"
28
- echo -e "${GREEN}Where humans become AI managers through rigorous methodology${NC}\n"
29
-
30
- # Check if we're in a git repository
31
- if [ ! -d ".git" ]; then
32
- echo -e "${RED}โŒ Error: Not in a git repository${NC}"
33
- echo "Please run this script from within a git repository."
34
- exit 1
35
- fi
36
-
37
- # Check if FRAIM is already installed
38
- if [ -d "FRAIM" ]; then
39
- echo -e "${YELLOW}โš ๏ธ FRAIM appears to already be installed in this repository${NC}"
40
- echo "If you want to reinstall, please remove the existing FRAIM folder first."
41
- exit 1
42
- fi
43
-
44
- echo -e "${BLUE}๐Ÿ“ฅ Installing FRAIM framework...${NC}"
45
-
46
- # Download FRAIM from GitHub
47
- echo "Downloading FRAIM framework..."
48
- curl -sSL https://raw.githubusercontent.com/mathursrus/FRAIM/master/install.sh | bash -s -- --repo $(git remote get-url origin | sed 's/.*github.com[:/]\([^/]*\/[^/]*\).*/\1/' | sed 's/\.git$//')
49
-
50
- echo -e "\n${GREEN}โœ… FRAIM installation complete!${NC}"
51
- echo -e "\n${BLUE}๐Ÿš€ Next steps:${NC}"
52
- echo "1. Review the FRAIM folder that was created"
53
- echo "2. Run: npx @fraim/framework init"
54
- echo "3. Start managing your AI agents with RIGOR methodology!"
55
- echo -e "\n${BLUE}๐Ÿ“š Learn more:${NC}"
56
- echo "Documentation: https://github.com/mathursrus/FRAIM"
57
- echo -e "\n${GREEN}๐ŸŽฏ Ready to become an AI manager?${NC}"
58
- echo "The FRAIM framework is now installed and ready to use!"