Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
102 lines
2.7 KiB
TypeScript
102 lines
2.7 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
import { View, Text, StyleSheet, ActivityIndicator } from 'react-native';
|
|
import { useRouter, useLocalSearchParams } from 'expo-router';
|
|
import { Colors } from '../../constants/Colors';
|
|
import { useAuthStore } from '../../store/authStore';
|
|
import { authService } from '../../services/authService';
|
|
import { logger } from '../../utils/logger';
|
|
import LoadingSpinner from '../../components/common/LoadingSpinner';
|
|
|
|
export default function GitHubCallbackScreen() {
|
|
const { code, error } = useLocalSearchParams<{ code?: string; error?: string }>();
|
|
const router = useRouter();
|
|
const { login } = useAuthStore();
|
|
const [status, setStatus] = useState<'processing' | 'success' | 'error'>('processing');
|
|
|
|
useEffect(() => {
|
|
handleCallback();
|
|
}, [code]);
|
|
|
|
const handleCallback = async () => {
|
|
if (error) {
|
|
logger.error('GitHub OAuth error:', error);
|
|
setStatus('error');
|
|
setTimeout(() => {
|
|
router.replace('/(auth)/login');
|
|
}, 2000);
|
|
return;
|
|
}
|
|
|
|
if (!code) {
|
|
setStatus('error');
|
|
setTimeout(() => {
|
|
router.replace('/(auth)/login');
|
|
}, 2000);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await authService.githubAuth(code);
|
|
await login(response.user, response.accessToken, response.refreshToken);
|
|
setStatus('success');
|
|
setTimeout(() => {
|
|
router.replace('/(tabs)/home');
|
|
}, 1000);
|
|
} catch (error: any) {
|
|
logger.error('GitHub auth error:', error);
|
|
setStatus('error');
|
|
setTimeout(() => {
|
|
router.replace('/(auth)/login');
|
|
}, 2000);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
{status === 'processing' && (
|
|
<>
|
|
<ActivityIndicator size="large" color={Colors.accent} />
|
|
<Text style={styles.text}>Completing GitHub login...</Text>
|
|
</>
|
|
)}
|
|
{status === 'success' && (
|
|
<>
|
|
<Text style={styles.successText}>✓</Text>
|
|
<Text style={styles.text}>Login successful!</Text>
|
|
</>
|
|
)}
|
|
{status === 'error' && (
|
|
<>
|
|
<Text style={styles.errorText}>✗</Text>
|
|
<Text style={styles.text}>Login failed. Redirecting...</Text>
|
|
</>
|
|
)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
padding: 20,
|
|
},
|
|
text: {
|
|
marginTop: 16,
|
|
fontSize: 16,
|
|
color: Colors.text,
|
|
textAlign: 'center',
|
|
},
|
|
successText: {
|
|
fontSize: 64,
|
|
color: Colors.accent,
|
|
},
|
|
errorText: {
|
|
fontSize: 64,
|
|
color: Colors.error || '#ff4444',
|
|
},
|
|
});
|
|
|