create-stylus-ide 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.
Files changed (135) hide show
  1. package/Readme.MD +1515 -0
  2. package/cli.js +28 -0
  3. package/frontend/.vscode/settings.json +9 -0
  4. package/frontend/app/api/chat/route.ts +101 -0
  5. package/frontend/app/api/check-setup/route.ts +93 -0
  6. package/frontend/app/api/cleanup/route.ts +14 -0
  7. package/frontend/app/api/compile/route.ts +95 -0
  8. package/frontend/app/api/compile-stream/route.ts +98 -0
  9. package/frontend/app/api/complete/route.ts +86 -0
  10. package/frontend/app/api/deploy/route.ts +118 -0
  11. package/frontend/app/api/export-abi/route.ts +58 -0
  12. package/frontend/app/favicon.ico +0 -0
  13. package/frontend/app/globals.css +177 -0
  14. package/frontend/app/layout.tsx +29 -0
  15. package/frontend/app/ml/page.tsx +694 -0
  16. package/frontend/app/page.tsx +1132 -0
  17. package/frontend/app/providers.tsx +18 -0
  18. package/frontend/app/qlearning/page.tsx +188 -0
  19. package/frontend/app/raytracing/page.tsx +268 -0
  20. package/frontend/components/abi/ABIDialog.tsx +132 -0
  21. package/frontend/components/ai/AICompletionPopup.tsx +76 -0
  22. package/frontend/components/ai/ChatPanel.tsx +292 -0
  23. package/frontend/components/ai/QuickActions.tsx +128 -0
  24. package/frontend/components/blockchain/BlockchainContractBanner.tsx +64 -0
  25. package/frontend/components/blockchain/BlockchainLoadingDialog.tsx +188 -0
  26. package/frontend/components/deploy/DeployDialog.tsx +334 -0
  27. package/frontend/components/editor/FileTabs.tsx +181 -0
  28. package/frontend/components/editor/MonacoEditor.tsx +306 -0
  29. package/frontend/components/file-tree/ContextMenu.tsx +110 -0
  30. package/frontend/components/file-tree/DeleteConfirmDialog.tsx +61 -0
  31. package/frontend/components/file-tree/FileInputDialog.tsx +97 -0
  32. package/frontend/components/file-tree/FileNode.tsx +60 -0
  33. package/frontend/components/file-tree/FileTree.tsx +259 -0
  34. package/frontend/components/file-tree/FileTreeSkeleton.tsx +26 -0
  35. package/frontend/components/file-tree/FolderNode.tsx +105 -0
  36. package/frontend/components/github/GitHubLoadingDialog.tsx +201 -0
  37. package/frontend/components/github/GitHubMetadataBanner.tsx +61 -0
  38. package/frontend/components/github/LoadFromGitHubDialog.tsx +125 -0
  39. package/frontend/components/github/URLCopyButton.tsx +60 -0
  40. package/frontend/components/interact/ContractInteraction.tsx +323 -0
  41. package/frontend/components/interact/ContractPlaceholder.tsx +41 -0
  42. package/frontend/components/orbit/BenchmarkDialog.tsx +342 -0
  43. package/frontend/components/orbit/OrbitExplorer.tsx +273 -0
  44. package/frontend/components/project/ProjectActions.tsx +176 -0
  45. package/frontend/components/q-learning/ContractConfig.tsx +172 -0
  46. package/frontend/components/q-learning/MazeGrid.tsx +346 -0
  47. package/frontend/components/q-learning/PathAnimation.tsx +384 -0
  48. package/frontend/components/q-learning/QTableHeatmap.tsx +300 -0
  49. package/frontend/components/q-learning/TrainingForm.tsx +349 -0
  50. package/frontend/components/ray-tracing/ContractConfig.tsx +245 -0
  51. package/frontend/components/ray-tracing/MintingForm.tsx +280 -0
  52. package/frontend/components/ray-tracing/RenderCanvas.tsx +228 -0
  53. package/frontend/components/ray-tracing/RenderingPanel.tsx +259 -0
  54. package/frontend/components/ray-tracing/StyleControls.tsx +217 -0
  55. package/frontend/components/setup/SetupGuide.tsx +290 -0
  56. package/frontend/components/ui/KeyboardShortcutHint.tsx +74 -0
  57. package/frontend/components/ui/alert-dialog.tsx +157 -0
  58. package/frontend/components/ui/alert.tsx +66 -0
  59. package/frontend/components/ui/badge.tsx +46 -0
  60. package/frontend/components/ui/button.tsx +62 -0
  61. package/frontend/components/ui/card.tsx +92 -0
  62. package/frontend/components/ui/context-menu.tsx +252 -0
  63. package/frontend/components/ui/dialog.tsx +143 -0
  64. package/frontend/components/ui/dropdown-menu.tsx +257 -0
  65. package/frontend/components/ui/input.tsx +21 -0
  66. package/frontend/components/ui/label.tsx +24 -0
  67. package/frontend/components/ui/progress.tsx +31 -0
  68. package/frontend/components/ui/scroll-area.tsx +58 -0
  69. package/frontend/components/ui/select.tsx +190 -0
  70. package/frontend/components/ui/separator.tsx +28 -0
  71. package/frontend/components/ui/sheet.tsx +139 -0
  72. package/frontend/components/ui/skeleton.tsx +13 -0
  73. package/frontend/components/ui/slider.tsx +63 -0
  74. package/frontend/components/ui/sonner.tsx +40 -0
  75. package/frontend/components/ui/tabs.tsx +66 -0
  76. package/frontend/components/ui/textarea.tsx +18 -0
  77. package/frontend/components/wallet/ConnectButton.tsx +167 -0
  78. package/frontend/components/wallet/FaucetButton.tsx +256 -0
  79. package/frontend/components.json +22 -0
  80. package/frontend/eslint.config.mjs +18 -0
  81. package/frontend/hooks/useAICompletion.ts +75 -0
  82. package/frontend/hooks/useBlockchainLoader.ts +58 -0
  83. package/frontend/hooks/useChats.ts +137 -0
  84. package/frontend/hooks/useCompilation.ts +173 -0
  85. package/frontend/hooks/useFileTabs.ts +178 -0
  86. package/frontend/hooks/useGitHubLoader.ts +50 -0
  87. package/frontend/hooks/useKeyboardShortcuts.ts +47 -0
  88. package/frontend/hooks/usePanelState.ts +115 -0
  89. package/frontend/hooks/useProjectState.ts +276 -0
  90. package/frontend/hooks/useResponsive.ts +29 -0
  91. package/frontend/lib/abi-parser.ts +58 -0
  92. package/frontend/lib/blockchain-api.ts +374 -0
  93. package/frontend/lib/blockchain-explorers.ts +75 -0
  94. package/frontend/lib/blockchain-loader.ts +112 -0
  95. package/frontend/lib/cargo-template.ts +64 -0
  96. package/frontend/lib/compilation.ts +529 -0
  97. package/frontend/lib/constants.ts +31 -0
  98. package/frontend/lib/deployment.ts +176 -0
  99. package/frontend/lib/file-utils.ts +83 -0
  100. package/frontend/lib/github-api.ts +246 -0
  101. package/frontend/lib/github-loader.ts +369 -0
  102. package/frontend/lib/ml-contract-template.txt +900 -0
  103. package/frontend/lib/orbit-chains.ts +181 -0
  104. package/frontend/lib/output-formatter.ts +68 -0
  105. package/frontend/lib/project-manager.ts +632 -0
  106. package/frontend/lib/ray-tracing-abi.ts +206 -0
  107. package/frontend/lib/storage.ts +189 -0
  108. package/frontend/lib/templates.ts +1662 -0
  109. package/frontend/lib/url-parser.ts +188 -0
  110. package/frontend/lib/utils.ts +6 -0
  111. package/frontend/lib/wagmi-config.ts +24 -0
  112. package/frontend/next.config.ts +7 -0
  113. package/frontend/package-lock.json +16259 -0
  114. package/frontend/package.json +60 -0
  115. package/frontend/postcss.config.mjs +7 -0
  116. package/frontend/public/file.svg +1 -0
  117. package/frontend/public/globe.svg +1 -0
  118. package/frontend/public/ml-weights/.gitkeep +0 -0
  119. package/frontend/public/ml-weights/model.pkl +0 -0
  120. package/frontend/public/ml-weights/model_weights.json +27102 -0
  121. package/frontend/public/ml-weights/test_samples.json +7888 -0
  122. package/frontend/public/next.svg +1 -0
  123. package/frontend/public/vercel.svg +1 -0
  124. package/frontend/public/window.svg +1 -0
  125. package/frontend/scripts/check-env.js +52 -0
  126. package/frontend/scripts/setup.js +285 -0
  127. package/frontend/tailwind.config.ts +64 -0
  128. package/frontend/tsconfig.json +34 -0
  129. package/frontend/types/blockchain.ts +63 -0
  130. package/frontend/types/github.ts +54 -0
  131. package/frontend/types/project.ts +106 -0
  132. package/ml-training/README.md +56 -0
  133. package/ml-training/train_tiny_model.py +325 -0
  134. package/ml-training/update_template.py +59 -0
  135. package/package.json +30 -0
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
@@ -0,0 +1,52 @@
1
+ const { exec } = require('child_process');
2
+ const { promisify } = require('util');
3
+
4
+ const execAsync = promisify(exec);
5
+
6
+ const colors = {
7
+ reset: '\x1b[0m',
8
+ green: '\x1b[32m',
9
+ red: '\x1b[31m',
10
+ yellow: '\x1b[33m',
11
+ };
12
+
13
+ async function checkCommand(command) {
14
+ try {
15
+ await execAsync(command, { timeout: 5000 });
16
+ return true;
17
+ } catch {
18
+ return false;
19
+ }
20
+ }
21
+
22
+ async function main() {
23
+ console.log('\n━━━ Environment Check ━━━\n');
24
+
25
+ const checks = {
26
+ rust: await checkCommand('rustc --version'),
27
+ cargo: await checkCommand('cargo --version'),
28
+ wasmTarget: false,
29
+ cargoStylus: await checkCommand('cargo stylus --version'),
30
+ };
31
+
32
+ try {
33
+ const { stdout } = await execAsync('rustup target list', { timeout: 5000 });
34
+ checks.wasmTarget = stdout.includes('wasm32-unknown-unknown (installed)');
35
+ } catch {}
36
+
37
+ console.log(`${checks.rust ? colors.green : colors.red}Rust: ${checks.rust ? '✓' : '✗'}${colors.reset}`);
38
+ console.log(`${checks.cargo ? colors.green : colors.red}Cargo: ${checks.cargo ? '✓' : '✗'}${colors.reset}`);
39
+ console.log(`${checks.wasmTarget ? colors.green : colors.red}WASM Target: ${checks.wasmTarget ? '✓' : '✗'}${colors.reset}`);
40
+ console.log(`${checks.cargoStylus ? colors.green : colors.red}Cargo Stylus: ${checks.cargoStylus ? '✓' : '✗'}${colors.reset}`);
41
+
42
+ const allGood = checks.rust && checks.cargo && checks.wasmTarget && checks.cargoStylus;
43
+
44
+ if (allGood) {
45
+ console.log(`\n${colors.green}✓ All requirements met!${colors.reset}`);
46
+ } else {
47
+ console.log(`\n${colors.yellow}⚠ Run 'npm run setup' to install missing components${colors.reset}`);
48
+ process.exit(1);
49
+ }
50
+ }
51
+
52
+ main();
@@ -0,0 +1,285 @@
1
+ const { exec, spawn } = require('child_process');
2
+ const { promisify } = require('util');
3
+ const readline = require('readline');
4
+
5
+ const execAsync = promisify(exec);
6
+
7
+ const rl = readline.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ });
11
+
12
+ const question = (query) => new Promise((resolve) => rl.question(query, resolve));
13
+
14
+ const colors = {
15
+ reset: '\x1b[0m',
16
+ green: '\x1b[32m',
17
+ red: '\x1b[31m',
18
+ yellow: '\x1b[33m',
19
+ blue: '\x1b[34m',
20
+ cyan: '\x1b[36m',
21
+ };
22
+
23
+ function log(message, color = colors.reset) {
24
+ console.log(`${color}${message}${colors.reset}`);
25
+ }
26
+
27
+ async function checkCommand(command) {
28
+ try {
29
+ await execAsync(command, { timeout: 5000 });
30
+ return true;
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+
36
+ async function getRustVersion() {
37
+ try {
38
+ const { stdout } = await execAsync('rustc --version', { timeout: 5000 });
39
+ const match = stdout.match(/rustc (\d+)\.(\d+)\.(\d+)/);
40
+ if (match) {
41
+ return {
42
+ major: parseInt(match[1]),
43
+ minor: parseInt(match[2]),
44
+ patch: parseInt(match[3]),
45
+ string: `${match[1]}.${match[2]}.${match[3]}`
46
+ };
47
+ }
48
+ } catch {}
49
+ return null;
50
+ }
51
+
52
+ function isRustVersionSufficient(version, minMajor = 1, minMinor = 88) {
53
+ if (!version) return false;
54
+ if (version.major > minMajor) return true;
55
+ if (version.major === minMajor && version.minor >= minMinor) return true;
56
+ return false;
57
+ }
58
+
59
+ async function runCommand(command, description) {
60
+ log(`\n${description}...`, colors.blue);
61
+ return new Promise((resolve, reject) => {
62
+ const child = spawn(command, [], {
63
+ shell: true,
64
+ stdio: 'inherit'
65
+ });
66
+
67
+ child.on('close', (code) => {
68
+ if (code === 0) {
69
+ log('✓ Success', colors.green);
70
+ resolve();
71
+ } else {
72
+ log(`✗ Failed with code ${code}`, colors.red);
73
+ reject(new Error(`Command failed: ${command}`));
74
+ }
75
+ });
76
+ });
77
+ }
78
+
79
+ async function installRust(platform) {
80
+ log('\n━━━ Installing Rust ━━━', colors.yellow);
81
+
82
+ if (platform === 'win32') {
83
+ log('\nWindows detected. Please:', colors.yellow);
84
+ log('1. Download Rust from: https://rustup.rs');
85
+ log('2. Run the installer (rustup-init.exe)');
86
+ log('3. Follow the installation prompts');
87
+
88
+ const answer = await question('\nHave you installed Rust? (y/n): ');
89
+ if (answer.toLowerCase() !== 'y') {
90
+ throw new Error('Rust installation required');
91
+ }
92
+ } else {
93
+ // Unix-like systems
94
+ await runCommand(
95
+ "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y",
96
+ 'Downloading and installing Rust'
97
+ );
98
+
99
+ // Source cargo env
100
+ log('\nConfiguring shell environment...', colors.blue);
101
+ process.env.PATH = `${process.env.HOME}/.cargo/bin:${process.env.PATH}`;
102
+ }
103
+ }
104
+
105
+ async function updateRust() {
106
+ log('\n━━━ Updating Rust ━━━', colors.yellow);
107
+ await runCommand('rustup update stable', 'Updating Rust to latest stable version');
108
+ }
109
+
110
+ async function installWasmTarget() {
111
+ log('\n━━━ Adding WASM Target ━━━', colors.yellow);
112
+ await runCommand(
113
+ 'rustup target add wasm32-unknown-unknown',
114
+ 'Installing wasm32-unknown-unknown target'
115
+ );
116
+ }
117
+
118
+ async function installCargoStylus(tryLocked = false) {
119
+ log('\n━━━ Installing Cargo Stylus ━━━', colors.yellow);
120
+
121
+ const command = tryLocked
122
+ ? 'cargo install cargo-stylus --locked'
123
+ : 'cargo install cargo-stylus';
124
+
125
+ const description = tryLocked
126
+ ? 'Installing cargo-stylus with locked dependencies (this may take several minutes)'
127
+ : 'Installing cargo-stylus (this may take several minutes)';
128
+
129
+ try {
130
+ await runCommand(command, description);
131
+ return true;
132
+ } catch (error) {
133
+ return false;
134
+ }
135
+ }
136
+
137
+ async function checkStatus() {
138
+ log('\n━━━ Checking Current Status ━━━', colors.yellow);
139
+
140
+ const checks = {
141
+ rust: await checkCommand('rustc --version'),
142
+ cargo: await checkCommand('cargo --version'),
143
+ wasmTarget: false,
144
+ cargoStylus: await checkCommand('cargo stylus --version'),
145
+ rustVersion: null,
146
+ };
147
+
148
+ // Get Rust version
149
+ checks.rustVersion = await getRustVersion();
150
+
151
+ // Check wasm target
152
+ try {
153
+ const { stdout } = await execAsync('rustup target list', { timeout: 5000 });
154
+ checks.wasmTarget = stdout.includes('wasm32-unknown-unknown (installed)');
155
+ } catch {
156
+ checks.wasmTarget = false;
157
+ }
158
+
159
+ log(`Rust: ${checks.rust ? '✓' : '✗'}`, checks.rust ? colors.green : colors.red);
160
+ if (checks.rustVersion) {
161
+ log(` Version: ${checks.rustVersion.string}`, colors.cyan);
162
+ }
163
+ log(`Cargo: ${checks.cargo ? '✓' : '✗'}`, checks.cargo ? colors.green : colors.red);
164
+ log(`WASM Target: ${checks.wasmTarget ? '✓' : '✗'}`, checks.wasmTarget ? colors.green : colors.red);
165
+ log(`Cargo Stylus: ${checks.cargoStylus ? '✓' : '✗'}`, checks.cargoStylus ? colors.green : colors.red);
166
+
167
+ return checks;
168
+ }
169
+
170
+ async function main() {
171
+ log('\n╔═══════════════════════════════════════╗', colors.blue);
172
+ log('║ Stylus IDE Environment Setup ║', colors.blue);
173
+ log('╚═══════════════════════════════════════╝\n', colors.blue);
174
+
175
+ const platform = process.platform;
176
+ log(`Detected platform: ${platform}`, colors.blue);
177
+
178
+ try {
179
+ // Check current status
180
+ const status = await checkStatus();
181
+
182
+ // Install Rust if missing
183
+ if (!status.rust || !status.cargo) {
184
+ const answer = await question('\nRust is not installed. Install now? (y/n): ');
185
+ if (answer.toLowerCase() === 'y') {
186
+ await installRust(platform);
187
+ log('\n⚠ Please restart your terminal and run this script again.', colors.yellow);
188
+ log('After restarting, run: npm run setup', colors.cyan);
189
+ process.exit(0);
190
+ } else {
191
+ throw new Error('Rust installation required');
192
+ }
193
+ }
194
+
195
+ // Check Rust version for cargo-stylus compatibility
196
+ const rustVersion = status.rustVersion;
197
+ const minRustVersion = { major: 1, minor: 88 };
198
+
199
+ if (rustVersion && !isRustVersionSufficient(rustVersion, minRustVersion.major, minRustVersion.minor)) {
200
+ log(`\n⚠ Warning: Rust ${rustVersion.string} detected`, colors.yellow);
201
+ log(` cargo-stylus v0.6.3+ requires Rust ${minRustVersion.major}.${minRustVersion.minor}+`, colors.yellow);
202
+ log(` You may encounter errors during cargo-stylus installation.\n`, colors.yellow);
203
+
204
+ const answer = await question(`Upgrade Rust to latest stable (recommended)? (y/n): `);
205
+ if (answer.toLowerCase() === 'y') {
206
+ await updateRust();
207
+
208
+ // Re-check version
209
+ const newVersion = await getRustVersion();
210
+ if (newVersion) {
211
+ log(`\n✓ Rust updated to ${newVersion.string}`, colors.green);
212
+ }
213
+ }
214
+ }
215
+
216
+ // Install WASM target
217
+ if (!status.wasmTarget) {
218
+ const answer = await question('\nWASM target is not installed. Install now? (y/n): ');
219
+ if (answer.toLowerCase() === 'y') {
220
+ await installWasmTarget();
221
+ } else {
222
+ throw new Error('WASM target required');
223
+ }
224
+ }
225
+
226
+ // Install Cargo Stylus
227
+ if (!status.cargoStylus) {
228
+ const answer = await question('\nCargo Stylus is not installed. Install now? (y/n): ');
229
+ if (answer.toLowerCase() === 'y') {
230
+ // Try normal install first
231
+ log('\nAttempting standard installation...', colors.blue);
232
+ const success = await installCargoStylus(false);
233
+
234
+ if (!success) {
235
+ log('\n⚠ Standard installation failed. This might be due to:', colors.yellow);
236
+ log(' - Rust version incompatibility', colors.yellow);
237
+ log(' - Network issues', colors.yellow);
238
+ log(' - Missing system dependencies\n', colors.yellow);
239
+
240
+ const retryAnswer = await question('Try installation with --locked flag? (y/n): ');
241
+ if (retryAnswer.toLowerCase() === 'y') {
242
+ const lockedSuccess = await installCargoStylus(true);
243
+
244
+ if (!lockedSuccess) {
245
+ log('\n✗ Installation with --locked also failed.', colors.red);
246
+ log('\nPossible solutions:', colors.yellow);
247
+ log('1. Update Rust: rustup update stable', colors.cyan);
248
+ log('2. Check system requirements: https://docs.arbitrum.io/stylus/stylus-quickstart', colors.cyan);
249
+ log('3. Try manual installation: cargo install cargo-stylus --force', colors.cyan);
250
+ throw new Error('cargo-stylus installation failed');
251
+ }
252
+ } else {
253
+ throw new Error('cargo-stylus installation required');
254
+ }
255
+ }
256
+ } else {
257
+ throw new Error('cargo-stylus installation required');
258
+ }
259
+ }
260
+
261
+ // Final check
262
+ log('\n━━━ Final Status ━━━', colors.yellow);
263
+ const finalStatus = await checkStatus();
264
+
265
+ const allGood = finalStatus.rust && finalStatus.cargo &&
266
+ finalStatus.wasmTarget && finalStatus.cargoStylus;
267
+
268
+ if (allGood) {
269
+ log('\n✓ Setup complete! You\'re ready to use Stylus IDE.', colors.green);
270
+ log('\nRun: npm run dev', colors.cyan);
271
+ } else {
272
+ log('\n⚠ Some components are still missing.', colors.yellow);
273
+ log('Please review the errors above and try again.', colors.yellow);
274
+ process.exit(1);
275
+ }
276
+
277
+ } catch (error) {
278
+ log(`\n✗ Setup failed: ${error.message}`, colors.red);
279
+ process.exit(1);
280
+ } finally {
281
+ rl.close();
282
+ }
283
+ }
284
+
285
+ main();
@@ -0,0 +1,64 @@
1
+ import type { Config } from "tailwindcss";
2
+
3
+ const config: Config = {
4
+ darkMode: "class",
5
+ content: [
6
+ "./pages/**/*.{js,ts,jsx,tsx,mdx}",
7
+ "./components/**/*.{js,ts,jsx,tsx,mdx}",
8
+ "./app/**/*.{js,ts,jsx,tsx,mdx}",
9
+ ],
10
+ theme: {
11
+ extend: {
12
+ colors: {
13
+ background: "hsl(var(--background))",
14
+ foreground: "hsl(var(--foreground))",
15
+ card: {
16
+ DEFAULT: "hsl(var(--card))",
17
+ foreground: "hsl(var(--card-foreground))",
18
+ },
19
+ popover: {
20
+ DEFAULT: "hsl(var(--popover))",
21
+ foreground: "hsl(var(--popover-foreground))",
22
+ },
23
+ primary: {
24
+ DEFAULT: "hsl(var(--primary))",
25
+ foreground: "hsl(var(--primary-foreground))",
26
+ },
27
+ secondary: {
28
+ DEFAULT: "hsl(var(--secondary))",
29
+ foreground: "hsl(var(--secondary-foreground))",
30
+ },
31
+ muted: {
32
+ DEFAULT: "hsl(var(--muted))",
33
+ foreground: "hsl(var(--muted-foreground))",
34
+ },
35
+ accent: {
36
+ DEFAULT: "hsl(var(--accent))",
37
+ foreground: "hsl(var(--accent-foreground))",
38
+ },
39
+ destructive: {
40
+ DEFAULT: "hsl(var(--destructive))",
41
+ foreground: "hsl(var(--destructive-foreground))",
42
+ },
43
+ border: "hsl(var(--border))",
44
+ input: "hsl(var(--input))",
45
+ ring: "hsl(var(--ring))",
46
+ chart: {
47
+ "1": "hsl(var(--chart-1))",
48
+ "2": "hsl(var(--chart-2))",
49
+ "3": "hsl(var(--chart-3))",
50
+ "4": "hsl(var(--chart-4))",
51
+ "5": "hsl(var(--chart-5))",
52
+ },
53
+ },
54
+ borderRadius: {
55
+ lg: "var(--radius)",
56
+ md: "calc(var(--radius) - 2px)",
57
+ sm: "calc(var(--radius) - 4px)",
58
+ },
59
+ },
60
+ },
61
+ plugins: [require("tailwindcss-animate")],
62
+ };
63
+
64
+ export default config;
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "react-jsx",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./*"]
23
+ }
24
+ },
25
+ "include": [
26
+ "next-env.d.ts",
27
+ "**/*.ts",
28
+ "**/*.tsx",
29
+ ".next/types/**/*.ts",
30
+ ".next/dev/types/**/*.ts",
31
+ "**/*.mts"
32
+ ],
33
+ "exclude": ["node_modules"]
34
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Blockchain explorer types
3
+ */
4
+
5
+ // types/blockchain.ts
6
+ export interface BlockchainExplorerConfig {
7
+ name: string;
8
+ chain: string;
9
+ network: string;
10
+ chainId: number; // ✅ add this
11
+ apiUrl: string;
12
+ explorerUrl: string;
13
+ apiKeyRequired: boolean;
14
+ }
15
+
16
+ export interface ContractSourceCode {
17
+ SourceCode: string;
18
+ ABI: string;
19
+ ContractName: string;
20
+ CompilerVersion: string;
21
+ OptimizationUsed: string;
22
+ Runs: string;
23
+ ConstructorArguments: string;
24
+ EVMVersion: string;
25
+ Library: string;
26
+ LicenseType: string;
27
+ Proxy: string;
28
+ Implementation: string;
29
+ SwarmSource: string;
30
+ }
31
+
32
+ export interface ExplorerAPIResponse {
33
+ status: string;
34
+ message: string;
35
+ result: ContractSourceCode[] | string;
36
+ }
37
+
38
+ export interface ParsedContractSource {
39
+ type: "single" | "multi-file" | "flattened";
40
+ files: {
41
+ path: string;
42
+ content: string;
43
+ }[];
44
+ mainFile: string;
45
+ }
46
+
47
+ // Add to existing file (keep everything else)
48
+
49
+ /**
50
+ * Contract data for interaction (not loading to editor)
51
+ */
52
+ export interface ContractInteractionData {
53
+ address: string;
54
+ name: string;
55
+ chain: string;
56
+ network: string;
57
+ chainId: number;
58
+ abi: string; // JSON string
59
+ verified: boolean;
60
+ compiler?: string;
61
+ optimization?: boolean;
62
+ explorerUrl: string;
63
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * GitHub API types
3
+ */
4
+
5
+ export interface GitHubFile {
6
+ path: string;
7
+ mode: string;
8
+ type: "blob" | "tree";
9
+ sha: string;
10
+ size?: number;
11
+ url: string;
12
+ }
13
+
14
+ export interface GitHubTree {
15
+ sha: string;
16
+ url: string;
17
+ tree: GitHubFile[];
18
+ truncated: boolean;
19
+ }
20
+
21
+ export interface GitHubContent {
22
+ name: string;
23
+ path: string;
24
+ sha: string;
25
+ size: number;
26
+ url: string;
27
+ html_url: string;
28
+ git_url: string;
29
+ download_url: string;
30
+ type: "file" | "dir";
31
+ content?: string; // Base64 encoded
32
+ encoding?: string;
33
+ }
34
+
35
+ export interface GitHubRepo {
36
+ id: number;
37
+ name: string;
38
+ full_name: string;
39
+ owner: {
40
+ login: string;
41
+ avatar_url: string;
42
+ };
43
+ description: string | null;
44
+ default_branch: string;
45
+ created_at: string;
46
+ updated_at: string;
47
+ stargazers_count: number;
48
+ language: string | null;
49
+ }
50
+
51
+ export interface GitHubError {
52
+ message: string;
53
+ documentation_url?: string;
54
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Project File Structure Types
3
+ * Core data structures for multi-file project management
4
+ */
5
+
6
+ export interface ProjectFile {
7
+ id: string; // Unique identifier (uuid)
8
+ path: string; // Full path: 'src/lib.rs'
9
+ name: string; // File name: 'lib.rs'
10
+ content: string; // File content
11
+ language: "rust" | "toml" | "markdown" | "text" | "gitignore";
12
+ modified: boolean; // Has unsaved changes
13
+ isOpen: boolean; // Is currently open in a tab
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+
18
+ // ✅ KEEP ONLY THIS ONE ProjectState (delete the duplicate below)
19
+ export interface ProjectState {
20
+ id: string;
21
+ name: string;
22
+ type: "stylus-contract" | "stylus-library";
23
+ files: ProjectFile[];
24
+ structure: FileNode[];
25
+ activeFilePath: string | null;
26
+ source: string;
27
+ createdAt: Date;
28
+ updatedAt: Date;
29
+ metadata?: {
30
+ source?: "github" | "blockchain" | "local";
31
+ owner?: string;
32
+ repo?: string;
33
+ branch?: string;
34
+ url?: string;
35
+ loadedAt?: string;
36
+ chain?: string;
37
+ address?: string;
38
+ folderPath?: string; // ✅ Make sure this is here
39
+ };
40
+ }
41
+
42
+ export interface FileNode {
43
+ id: string; // Unique identifier
44
+ name: string; // Display name
45
+ path: string; // Full path
46
+ type: "file" | "folder";
47
+ children?: FileNode[]; // For folders only
48
+ expanded?: boolean; // Folder expansion state
49
+ parentId?: string | null; // Parent folder ID
50
+ }
51
+
52
+ // ❌ DELETE THIS DUPLICATE - You have ProjectState declared twice!
53
+ // export interface ProjectState {
54
+ // id: string;
55
+ // name: string;
56
+ // files: ProjectFile[];
57
+ // structure: FileNode[];
58
+ // activeFilePath: string | null;
59
+ // source: string;
60
+ // createdAt: Date;
61
+ // updatedAt: Date;
62
+ // metadata?: { ... }
63
+ // }
64
+
65
+ export interface ProjectMetadata {
66
+ // For GitHub-loaded projects
67
+ githubUrl?: string;
68
+ owner?: string;
69
+ repo?: string;
70
+ branch?: string;
71
+
72
+ // For on-chain loaded contracts
73
+ contractAddress?: string;
74
+ chainId?: number;
75
+ verified?: boolean;
76
+ verifiedAt?: Date;
77
+ compiler?: string;
78
+
79
+ // General
80
+ description?: string;
81
+ tags?: string[];
82
+ }
83
+
84
+ export interface CreateFileOptions {
85
+ path: string;
86
+ content?: string;
87
+ language?: ProjectFile["language"];
88
+ }
89
+
90
+ export interface CreateFolderOptions {
91
+ path: string;
92
+ }
93
+
94
+ export interface MoveFileOptions {
95
+ fromPath: string;
96
+ toPath: string;
97
+ }
98
+
99
+ export interface RenameOptions {
100
+ oldPath: string;
101
+ newPath: string;
102
+ }
103
+
104
+ // Helper types
105
+ export type FileLanguage = ProjectFile["language"];
106
+ export type ProjectSource = ProjectState["source"];