Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Add client ESLint and pre-commit lint checks

[._.]/ Adam Eivyae47b2e7ddff
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index 54823ac3ac..37556e4517 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -41,6 +41,8 @@ if [ "$run_server" = true ]; then
fi
if [ "$run_client" = true ]; then
+ printf -- "- running client lint...\n"
+ npm run lint --prefix client
printf -- "- running client build...\n"
npm run build --prefix client
fi
diff --git a/client/eslint.config.js b/client/eslint.config.js
new file mode 100644
index 0000000000..3ee363033f
--- /dev/null
+++ b/client/eslint.config.js
@@ -0,0 +1,54 @@
+import js from '@eslint/js';
+import globals from 'globals';
+import reactPlugin from 'eslint-plugin-react';
+import reactHooksPlugin from 'eslint-plugin-react-hooks';
+
+export default [
+ {
+ ignores: ['dist/**', 'node_modules/**'],
+ },
+ js.configs.recommended,
+ {
+ files: ['src/**/*.{js,jsx}'],
+ languageOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'module',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ },
+ },
+ plugins: {
+ react: reactPlugin,
+ 'react-hooks': reactHooksPlugin,
+ },
+ settings: {
+ react: {
+ version: 'detect',
+ },
+ },
+ rules: {
+ ...reactPlugin.configs.recommended.rules,
+ ...reactHooksPlugin.configs.recommended.rules,
+ 'react/react-in-jsx-scope': 'off',
+ 'react/prop-types': 'off',
+ 'react/no-unknown-property': 'off',
+ 'react/no-unescaped-entities': 'off',
+ 'react/jsx-no-comment-textnodes': 'off',
+ 'no-unused-vars': ['warn', {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ caughtErrorsIgnorePattern: '^_'
+ }],
+ 'no-undef': 'error',
+ 'no-useless-escape': 'warn',
+ 'react-hooks/rules-of-hooks': 'warn',
+ 'react-hooks/exhaustive-deps': 'warn',
+ },
+ },
+];
diff --git a/client/package.json b/client/package.json
index 787bfcf45a..8dab033302 100644
--- a/client/package.json
+++ b/client/package.json
@@ -6,6 +6,7 @@
"scripts": {
"dev": "vite --host 0.0.0.0 --port 5554",
"build": "vite build",
+ "lint": "eslint src --ext .js,.jsx",
"preview": "vite preview"
},
"dependencies": {
@@ -31,8 +32,13 @@
"three": "^0.182.0"
},
"devDependencies": {
+ "@eslint/js": "^9.23.0",
"@tailwindcss/postcss": "^4.2.1",
"@vitejs/plugin-react": "^5.1.4",
+ "eslint": "^9.23.0",
+ "eslint-plugin-react": "^7.37.5",
+ "eslint-plugin-react-hooks": "^5.2.0",
+ "globals": "^16.0.0",
"tailwindcss": "^4.2.1",
"vite": "^7.3.1"
}
diff --git a/client/src/hooks/useCityData.js b/client/src/hooks/useCityData.js
index 85a19d168a..dcc600f670 100644
--- a/client/src/hooks/useCityData.js
+++ b/client/src/hooks/useCityData.js
@@ -8,6 +8,8 @@ export const useCityData = () => {
const [cosStatus, setCosStatus] = useState({ running: false });
const [runningAgents, setRunningAgents] = useState([]);
const [eventLogs, setEventLogs] = useState([]);
+ const [reviewCounts, setReviewCounts] = useState({ total: 0, alert: 0, todo: 0, briefing: 0, cos: 0 });
+ const [instances, setInstances] = useState({ self: null, peers: [], syncStatus: null });
const [loading, setLoading] = useState(true);
const pollRef = useRef(null);
@@ -18,12 +20,15 @@ export const useCityData = () => {
}, []);
const fetchAll = useCallback(async () => {
- const [appsData, agents, cosAgentsData, status] = await Promise.all([
+ const [appsData, agents, cosAgentsData, status, reviewData, instanceData] = await Promise.all([
api.getApps().catch(() => []),
api.getRunningAgents().catch(() => []),
api.getCosAgents().catch(() => []),
api.getCosStatus().catch(() => ({ running: false })),
+ api.getReviewCounts().catch(() => ({ total: 0, alert: 0, todo: 0, briefing: 0, cos: 0 })),
+ api.getInstances().catch(() => ({ self: null, peers: [], syncStatus: null })),
]);
+
setApps(appsData);
setRunningAgents(agents);
setCosAgents(cosAgentsData);
@@ -33,7 +38,6 @@ export const useCityData = () => {
setLoading(false);
}, []);
- // Build agent-to-app mapping
const agentMap = useMemo(() => {
const map = new Map();
const allAgents = [...(cosAgents || [])];
@@ -56,16 +60,13 @@ export const useCityData = () => {
useEffect(() => {
fetchAll();
- // Subscribe to CoS events
const subscribe = () => socket.emit('cos:subscribe');
if (socket.connected) subscribe();
socket.on('connect', subscribe);
- // App changes
const handleAppsChanged = () => fetchApps();
socket.on('apps:changed', handleAppsChanged);
- // CoS agent events
const handleAgentSpawned = (data) => {
setCosAgents(prev => [...prev, data]);
fetchAll();
@@ -82,19 +83,16 @@ export const useCityData = () => {
};
socket.on('cos:agent:completed', handleAgentCompleted);
- // CoS log events
const handleCosLog = (data) => {
setEventLogs(prev => [...prev, { ...data, timestamp: data.timestamp || Date.now() }].slice(-50));
};
socket.on('cos:log', handleCosLog);
- // CoS status
const handleCosStatus = (data) => {
setCosStatus(prev => ({ ...prev, running: data.running }));
};
socket.on('cos:status', handleCosStatus);
- // Poll running agents (no socket events for system agents)
pollRef.current = setInterval(async () => {
const agents = await api.getRunningAgents().catch(() => []);
setRunningAgents(agents);