edoardo 1.0.0
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.
- package/README.md +73 -0
- package/bin/cli.js +114 -0
- package/dist/assets/index-CjTbnCaz.js +74 -0
- package/dist/assets/index-DhSyZqPa.css +1 -0
- package/dist/favicon.svg +10 -0
- package/dist/index.html +14 -0
- package/dist/vite.svg +1 -0
- package/package.json +88 -0
- package/server/standalone.js +697 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn, exec } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
const rootDir = join(__dirname, '..');
|
|
11
|
+
|
|
12
|
+
// Parse command line arguments
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const portArg = args.find(arg => arg.startsWith('--port='));
|
|
15
|
+
const PORT = portArg ? parseInt(portArg.split('=')[1]) : 3001;
|
|
16
|
+
const noOpen = args.includes('--no-open');
|
|
17
|
+
const helpRequested = args.includes('--help') || args.includes('-h');
|
|
18
|
+
|
|
19
|
+
if (helpRequested) {
|
|
20
|
+
console.log(`
|
|
21
|
+
Edoardo - AI Agent with MCP Plugin Support
|
|
22
|
+
|
|
23
|
+
Usage: edoardo [options]
|
|
24
|
+
|
|
25
|
+
Options:
|
|
26
|
+
--port=<number> Set the server port (default: 3001)
|
|
27
|
+
--no-open Don't open browser automatically
|
|
28
|
+
--help, -h Show this help message
|
|
29
|
+
|
|
30
|
+
Examples:
|
|
31
|
+
edoardo Start on default port 3001
|
|
32
|
+
edoardo --port=8080 Start on port 8080
|
|
33
|
+
edoardo --no-open Start without opening browser
|
|
34
|
+
`);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Check if dist folder exists (production build)
|
|
39
|
+
const distPath = join(rootDir, 'dist');
|
|
40
|
+
const hasDistBuild = existsSync(distPath);
|
|
41
|
+
|
|
42
|
+
if (!hasDistBuild) {
|
|
43
|
+
console.error('\x1b[31mError: Production build not found.\x1b[0m');
|
|
44
|
+
console.error('Please run "npm run build" first or reinstall the package.');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log('\x1b[36m');
|
|
49
|
+
console.log(' ╔═══════════════════════════════════════════╗');
|
|
50
|
+
console.log(' ║ ║');
|
|
51
|
+
console.log(' ║ 🤖 Edoardo - AI Agent ║');
|
|
52
|
+
console.log(' ║ ║');
|
|
53
|
+
console.log(' ╚═══════════════════════════════════════════╝');
|
|
54
|
+
console.log('\x1b[0m');
|
|
55
|
+
|
|
56
|
+
console.log(` Starting server on port ${PORT}...`);
|
|
57
|
+
console.log('');
|
|
58
|
+
|
|
59
|
+
// Start the production server
|
|
60
|
+
const serverPath = join(rootDir, 'server', 'standalone.js');
|
|
61
|
+
|
|
62
|
+
const server = spawn('node', [serverPath], {
|
|
63
|
+
cwd: rootDir,
|
|
64
|
+
stdio: 'inherit',
|
|
65
|
+
env: {
|
|
66
|
+
...process.env,
|
|
67
|
+
PORT: String(PORT),
|
|
68
|
+
NODE_ENV: 'production',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
server.on('error', (err) => {
|
|
73
|
+
console.error('\x1b[31mFailed to start server:\x1b[0m', err.message);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Open browser after a short delay (give server time to start)
|
|
78
|
+
if (!noOpen) {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
const url = `http://localhost:${PORT}`;
|
|
81
|
+
console.log(` Opening browser at ${url}...`);
|
|
82
|
+
|
|
83
|
+
// Cross-platform open browser
|
|
84
|
+
const platform = process.platform;
|
|
85
|
+
let command;
|
|
86
|
+
|
|
87
|
+
if (platform === 'darwin') {
|
|
88
|
+
command = `open "${url}"`;
|
|
89
|
+
} else if (platform === 'win32') {
|
|
90
|
+
command = `start "" "${url}"`;
|
|
91
|
+
} else {
|
|
92
|
+
command = `xdg-open "${url}"`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
exec(command, (err) => {
|
|
96
|
+
if (err) {
|
|
97
|
+
console.log(` \x1b[33mCouldn't open browser automatically.\x1b[0m`);
|
|
98
|
+
console.log(` Please open ${url} manually.`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}, 1500);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Handle graceful shutdown
|
|
105
|
+
process.on('SIGINT', () => {
|
|
106
|
+
console.log('\n Shutting down...');
|
|
107
|
+
server.kill();
|
|
108
|
+
process.exit(0);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
process.on('SIGTERM', () => {
|
|
112
|
+
server.kill();
|
|
113
|
+
process.exit(0);
|
|
114
|
+
});
|