1+ name : Sync Features from Python SDK
2+
3+ on :
4+ schedule :
5+ # Run daily at 2 AM UTC
6+ - cron : ' 0 2 * * *'
7+ workflow_dispatch : # Allow manual trigger
8+ repository_dispatch :
9+ types : [python-sdk-update]
10+
11+ jobs :
12+ check-python-sdk :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout JS SDK
16+ uses : actions/checkout@v4
17+
18+ - name : Setup Node.js
19+ uses : actions/setup-node@v4
20+ with :
21+ node-version : ' 18'
22+ cache : ' npm'
23+
24+ - name : Install dependencies
25+ run : npm install
26+
27+ - name : Fetch Python SDK structure
28+ id : fetch-python-sdk
29+ run : |
30+ # Get latest Python SDK structure
31+ curl -s "https://api.github.com/repos/multimindlab/multimind-sdk/contents/multimind" > python_sdk_structure.json
32+
33+ # Extract module names
34+ MODULES=$(cat python_sdk_structure.json | jq -r '.[].name' | grep -v '__pycache__' | sort)
35+ echo "modules<<EOF" >> $GITHUB_OUTPUT
36+ echo "$MODULES" >> $GITHUB_OUTPUT
37+ echo "EOF" >> $GITHUB_OUTPUT
38+
39+ # Get commit hash for reference
40+ COMMIT_HASH=$(curl -s "https://api.github.com/repos/multimindlab/multimind-sdk/commits/develop" | jq -r '.sha' | cut -c1-7)
41+ echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
42+
43+ - name : Check JS SDK structure
44+ id : check-js-sdk
45+ run : |
46+ # Get JS SDK modules
47+ JS_MODULES=$(find src -name "*.ts" -not -name "*.d.ts" | sed 's|src/||' | sed 's|\.ts||' | sort)
48+ echo "js_modules<<EOF" >> $GITHUB_OUTPUT
49+ echo "$JS_MODULES" >> $GITHUB_OUTPUT
50+ echo "EOF" >> $GITHUB_OUTPUT
51+
52+ - name : Compare and create issues
53+ run : |
54+ # Create comparison script
55+ cat > compare_modules.js << 'EOF'
56+ const fs = require('fs');
57+
58+ const pythonModules = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf-8')
59+ .split('\n')
60+ .filter(line => line.startsWith('modules<<'))
61+ .map(line => line.replace('modules<<EOF', ''))
62+ .join('\n')
63+ .split('\n')
64+ .filter(Boolean);
65+
66+ const jsModules = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf-8')
67+ .split('\n')
68+ .filter(line => line.startsWith('js_modules<<'))
69+ .map(line => line.replace('js_modules<<EOF', ''))
70+ .join('\n')
71+ .split('\n')
72+ .filter(Boolean);
73+
74+ const missingInJS = pythonModules.filter(module => !jsModules.includes(module));
75+
76+ if (missingInJS.length > 0) {
77+ console.log('Missing modules in JS SDK:');
78+ missingInJS.forEach(module => {
79+ console.log(`- ${module}`);
80+ });
81+
82+ // Create issue for each missing module
83+ missingInJS.forEach(module => {
84+ const issueBody = `## New Python SDK Module Detected: \`${module}\`
85+
86+ **Python SDK Commit:** ${process.env.COMMIT_HASH}
87+ **Detection Date:** ${new Date().toISOString()}
88+
89+ ### Action Required
90+ - [ ] Review the Python SDK module: \`multimind/${module}/\`
91+ - [ ] Implement equivalent functionality in JS SDK
92+ - [ ] Add to bridge imports
93+ - [ ] Add to main exports
94+ - [ ] Create examples/CLI if applicable
95+ - [ ] Update documentation
96+
97+ ### Python SDK Structure
98+ \`\`\`bash
99+ curl -s "https://api.github.com/repos/multimindlab/multimind-sdk/contents/multimind/${module}" | jq -r '.[].name'
100+ \`\`\`
101+
102+ ### Implementation Checklist
103+ - [ ] Create \`src/${module}.ts\` or \`src/${module}/\` directory
104+ - [ ] Add TypeScript interfaces/types
105+ - [ ] Implement bridge calls to Python SDK
106+ - [ ] Add to \`src/index.ts\` exports
107+ - [ ] Add to \`src/bridge/multimind-bridge.ts\` imports
108+ - [ ] Create example usage
109+ - [ ] Add tests
110+ - [ ] Update README.md
111+
112+ **Priority:** Medium
113+ **Labels:** enhancement, python-sync, new-feature`;
114+
115+ // Use GitHub CLI to create issue
116+ console.log(`Creating issue for module: ${module}`);
117+ // Note: This would require GitHub CLI setup and proper permissions
118+ });
119+ } else {
120+ console.log('✅ All Python SDK modules are present in JS SDK');
121+ }
122+ EOF
123+
124+ node compare_modules.js
125+
126+ - name : Create sync report
127+ run : |
128+ echo "## Feature Sync Report" >> sync_report.md
129+ echo "**Date:** $(date)" >> sync_report.md
130+ echo "**Python SDK Commit:** ${{ steps.fetch-python-sdk.outputs.commit_hash }}" >> sync_report.md
131+ echo "" >> sync_report.md
132+ echo "### Status: ✅ All modules synced" >> sync_report.md
133+
134+ # Upload report as artifact
135+ echo "sync_report.md" > artifacts.txt
136+
137+ - name : Upload sync report
138+ uses : actions/upload-artifact@v4
139+ with :
140+ name : sync-report
141+ path : sync_report.md
0 commit comments