stylus-toolkit 0.1.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 (78) hide show
  1. package/.claude/settings.local.json +20 -0
  2. package/CHANGELOG.md +30 -0
  3. package/CONTRIBUTING.md +50 -0
  4. package/LICENSE +21 -0
  5. package/README.md +132 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +62 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/commands/benchmark.d.ts +3 -0
  11. package/dist/commands/benchmark.d.ts.map +1 -0
  12. package/dist/commands/benchmark.js +18 -0
  13. package/dist/commands/benchmark.js.map +1 -0
  14. package/dist/commands/config.d.ts +9 -0
  15. package/dist/commands/config.d.ts.map +1 -0
  16. package/dist/commands/config.js +63 -0
  17. package/dist/commands/config.js.map +1 -0
  18. package/dist/commands/init.d.ts +3 -0
  19. package/dist/commands/init.d.ts.map +1 -0
  20. package/dist/commands/init.js +115 -0
  21. package/dist/commands/init.js.map +1 -0
  22. package/dist/commands/profile.d.ts +3 -0
  23. package/dist/commands/profile.d.ts.map +1 -0
  24. package/dist/commands/profile.js +160 -0
  25. package/dist/commands/profile.js.map +1 -0
  26. package/dist/compiler/rust-compiler.d.ts +12 -0
  27. package/dist/compiler/rust-compiler.d.ts.map +1 -0
  28. package/dist/compiler/rust-compiler.js +141 -0
  29. package/dist/compiler/rust-compiler.js.map +1 -0
  30. package/dist/compiler/solidity-compiler.d.ts +10 -0
  31. package/dist/compiler/solidity-compiler.d.ts.map +1 -0
  32. package/dist/compiler/solidity-compiler.js +160 -0
  33. package/dist/compiler/solidity-compiler.js.map +1 -0
  34. package/dist/exporter/exporter.d.ts +13 -0
  35. package/dist/exporter/exporter.d.ts.map +1 -0
  36. package/dist/exporter/exporter.js +322 -0
  37. package/dist/exporter/exporter.js.map +1 -0
  38. package/dist/index.d.ts +11 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +37 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/profiler/comparator.d.ts +10 -0
  43. package/dist/profiler/comparator.d.ts.map +1 -0
  44. package/dist/profiler/comparator.js +96 -0
  45. package/dist/profiler/comparator.js.map +1 -0
  46. package/dist/profiler/gas-profiler.d.ts +11 -0
  47. package/dist/profiler/gas-profiler.d.ts.map +1 -0
  48. package/dist/profiler/gas-profiler.js +143 -0
  49. package/dist/profiler/gas-profiler.js.map +1 -0
  50. package/dist/storage/results-store.d.ts +16 -0
  51. package/dist/storage/results-store.d.ts.map +1 -0
  52. package/dist/storage/results-store.js +107 -0
  53. package/dist/storage/results-store.js.map +1 -0
  54. package/dist/templates/generator.d.ts +11 -0
  55. package/dist/templates/generator.d.ts.map +1 -0
  56. package/dist/templates/generator.js +135 -0
  57. package/dist/templates/generator.js.map +1 -0
  58. package/dist/templates/templates.d.ts +2 -0
  59. package/dist/templates/templates.d.ts.map +1 -0
  60. package/dist/templates/templates.js +324 -0
  61. package/dist/templates/templates.js.map +1 -0
  62. package/dist/types/index.d.ts +115 -0
  63. package/dist/types/index.d.ts.map +1 -0
  64. package/dist/types/index.js +3 -0
  65. package/dist/types/index.js.map +1 -0
  66. package/dist/utils/config.d.ts +15 -0
  67. package/dist/utils/config.d.ts.map +1 -0
  68. package/dist/utils/config.js +77 -0
  69. package/dist/utils/config.js.map +1 -0
  70. package/dist/utils/file-system.d.ts +14 -0
  71. package/dist/utils/file-system.d.ts.map +1 -0
  72. package/dist/utils/file-system.js +84 -0
  73. package/dist/utils/file-system.js.map +1 -0
  74. package/dist/utils/logger.d.ts +20 -0
  75. package/dist/utils/logger.d.ts.map +1 -0
  76. package/dist/utils/logger.js +76 -0
  77. package/dist/utils/logger.js.map +1 -0
  78. package/package.json +75 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm install:*)",
5
+ "Bash(node dist/cli.js:*)",
6
+ "Bash(tree:*)",
7
+ "Bash(cat:*)",
8
+ "Bash(find:*)",
9
+ "Bash(npm run build:*)",
10
+ "Bash(stylus-toolkit init:*)",
11
+ "Bash(stylus-toolkit:*)",
12
+ "Bash(test:*)",
13
+ "Bash(rustc:*)",
14
+ "Bash(time cargo build:*)",
15
+ "Bash(cargo search:*)",
16
+ "Bash(ls:*)",
17
+ "Bash(npm pack:*)"
18
+ ]
19
+ }
20
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2025-01-06
4
+
5
+ ### Added
6
+
7
+ - Project initialization with templates (ERC-20, ERC-721, DeFi, Basic)
8
+ - Gas profiling for Rust and Solidity contracts
9
+ - Cross-language gas comparison
10
+ - Multi-format export (JSON, CSV, HTML)
11
+ - Configuration management
12
+ - Network support (local, Arbitrum Sepolia, Arbitrum One)
13
+
14
+ ### Features
15
+
16
+ - Rust compiler with WASM support
17
+ - Solidity compiler with native and JS fallback
18
+ - Deployment gas measurement
19
+ - Function-level gas profiling
20
+ - Statistical analysis
21
+ - Result storage system
22
+
23
+ ## [Unreleased]
24
+
25
+ ### Planned
26
+
27
+ - Docker-based local testnet
28
+ - Web analytics dashboard
29
+ - Enhanced benchmarking
30
+ - Video tutorials
@@ -0,0 +1,50 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing to Stylus Toolkit!
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/soloking1412/stylus-toolkit.git
9
+ cd stylus-toolkit
10
+ npm install
11
+ npm run build
12
+ npm link
13
+ ```
14
+
15
+ ## Making Changes
16
+
17
+ 1. Fork the repository
18
+ 2. Create a feature branch (`git checkout -b feature/my-feature`)
19
+ 3. Make your changes
20
+ 4. Run tests and linter
21
+ 5. Commit your changes
22
+ 6. Push to your fork
23
+ 7. Open a pull request
24
+
25
+ ## Code Style
26
+
27
+ - Use TypeScript
28
+ - Follow existing code patterns
29
+ - Run `npm run lint` before committing
30
+ - Run `npm run format` to format code
31
+
32
+ ## Testing
33
+
34
+ ```bash
35
+ npm test
36
+ npm run test:coverage
37
+ ```
38
+
39
+ ## Commit Messages
40
+
41
+ Use descriptive commit messages:
42
+
43
+ - `feat: add new feature`
44
+ - `fix: resolve bug`
45
+ - `docs: update documentation`
46
+ - `refactor: improve code structure`
47
+
48
+ ## License
49
+
50
+ By contributing, you agree that your contributions will be licensed under MIT.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Maheswaran Velmurugan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # Stylus Toolkit
2
+
3
+ CLI tool for building and profiling Arbitrum Stylus smart contracts.
4
+
5
+ [![License](https://img.shields.io/npm/l/stylus-toolkit)](LICENSE)
6
+
7
+ ## Features
8
+
9
+ - Gas profiling for Rust and Solidity contracts
10
+ - Side-by-side performance comparison
11
+ - Project templates (ERC-20, ERC-721, DeFi, Basic)
12
+ - Multi-format exports (JSON, CSV, HTML)
13
+ - Cross-platform support
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install -g stylus-toolkit
19
+ ```
20
+
21
+ **Prerequisites:** Node.js 16+, Rust/Cargo
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # Create new project
27
+ stylus-toolkit init
28
+
29
+ # Profile gas usage
30
+ cd my-stylus-project
31
+ stylus-toolkit profile --export html
32
+ ```
33
+
34
+ ## Commands
35
+
36
+ ### init
37
+
38
+ Initialize a new Stylus project.
39
+
40
+ ```bash
41
+ stylus-toolkit init [options]
42
+
43
+ Options:
44
+ -n, --name <name> Project name
45
+ -t, --template <template> Template (basic, erc20, erc721, defi)
46
+ --rust-only Rust only
47
+ --solidity-only Solidity only
48
+ ```
49
+
50
+ ### profile
51
+
52
+ Profile and compare gas usage.
53
+
54
+ ```bash
55
+ stylus-toolkit profile [options]
56
+
57
+ Options:
58
+ -c, --contract <name> Contract name
59
+ -r, --rpc <url> RPC endpoint
60
+ -n, --network <network> Network (local, arbitrum-sepolia, arbitrum-one)
61
+ --export <format> Export format (json, csv, html)
62
+ --detailed Show detailed breakdown
63
+ ```
64
+
65
+ ### config
66
+
67
+ Manage configuration.
68
+
69
+ ```bash
70
+ stylus-toolkit config [options]
71
+
72
+ Options:
73
+ --set <key=value> Set config value
74
+ --get <key> Get config value
75
+ --list List all config
76
+ --reset Reset to defaults
77
+ ```
78
+
79
+ ## Example Output
80
+
81
+ ```
82
+ ┌────────────┬──────────────┬──────────────┬──────────┬────────┐
83
+ │ Metric │ Rust │ Solidity │ Savings │ % │
84
+ ├────────────┼──────────────┼──────────────┼──────────┼────────┤
85
+ │ Deployment │ 120,456 │ 845,231 │ 724,775 │ 85.75% │
86
+ │ increment │ 2,341 │ 43,892 │ 41,551 │ 94.67% │
87
+ └────────────┴──────────────┴──────────────┴──────────┴────────┘
88
+ ```
89
+
90
+ ## Configuration
91
+
92
+ Default networks:
93
+ - Local: `http://localhost:8547`
94
+ - Arbitrum Sepolia: Testnet
95
+ - Arbitrum One: Mainnet
96
+
97
+ Add custom networks:
98
+
99
+ ```bash
100
+ stylus-toolkit config --set networks.custom.rpcUrl=https://your-rpc.com
101
+ ```
102
+
103
+ ## Project Structure
104
+
105
+ ```
106
+ my-project/
107
+ ├── contracts-rust/
108
+ │ └── src/lib.rs
109
+ ├── contracts-solidity/
110
+ │ └── Contract.sol
111
+ ├── .stylus-toolkit/
112
+ └── README.md
113
+ ```
114
+
115
+ ## Development
116
+
117
+ ```bash
118
+ git clone https://github.com/soloking1412/stylus-toolkit.git
119
+ cd stylus-toolkit
120
+ npm install
121
+ npm run build
122
+ ```
123
+
124
+ ## License
125
+
126
+ MIT
127
+
128
+ ## Links
129
+
130
+ - [Stylus Docs](https://docs.arbitrum.io/stylus/stylus-gentle-introduction)
131
+ - [Stylus SDK](https://github.com/OffchainLabs/stylus-sdk-rs)
132
+ - [Issues](https://github.com/soloking1412/stylus-toolkit/issues)
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const init_1 = require("./commands/init");
10
+ const profile_1 = require("./commands/profile");
11
+ const benchmark_1 = require("./commands/benchmark");
12
+ const config_1 = require("./commands/config");
13
+ const program = new commander_1.Command();
14
+ program
15
+ .name('stylus-toolkit')
16
+ .description('A comprehensive CLI development environment for Arbitrum Stylus smart contracts')
17
+ .version('0.1.0');
18
+ program
19
+ .command('init')
20
+ .description('Initialize a new Stylus project')
21
+ .option('-n, --name <name>', 'Project name')
22
+ .option('-t, --template <template>', 'Project template (erc20, erc721, defi, basic)', 'basic')
23
+ .option('--rust-only', 'Initialize Rust-only project')
24
+ .option('--solidity-only', 'Initialize Solidity-only project')
25
+ .action(init_1.initCommand);
26
+ program
27
+ .command('profile')
28
+ .description('Profile and compare gas usage between Rust (Stylus) and Solidity implementations')
29
+ .option('-c, --contract <name>', 'Contract name to profile')
30
+ .option('-r, --rpc <url>', 'RPC endpoint URL')
31
+ .option('-n, --network <network>', 'Network name (arbitrum-sepolia, arbitrum-one, local)', 'local')
32
+ .option('--rust-path <path>', 'Path to Rust contract')
33
+ .option('--solidity-path <path>', 'Path to Solidity contract')
34
+ .option('--export <format>', 'Export format (json, csv, html)', 'json')
35
+ .option('--no-compile', 'Skip compilation step')
36
+ .option('--detailed', 'Show detailed gas breakdown')
37
+ .action(profile_1.profileCommand);
38
+ program
39
+ .command('benchmark')
40
+ .description('Run comprehensive benchmarks on contracts')
41
+ .option('-c, --contract <name>', 'Contract name to benchmark')
42
+ .option('-i, --iterations <number>', 'Number of iterations', '10')
43
+ .option('--export <format>', 'Export format (json, csv, html)', 'json')
44
+ .action(benchmark_1.benchmarkCommand);
45
+ program
46
+ .command('config')
47
+ .description('Manage toolkit configuration')
48
+ .option('--set <key=value>', 'Set configuration value')
49
+ .option('--get <key>', 'Get configuration value')
50
+ .option('--list', 'List all configuration')
51
+ .option('--reset', 'Reset to default configuration')
52
+ .action(config_1.configCommand);
53
+ program.on('command:*', function () {
54
+ console.error(chalk_1.default.red('Invalid command: %s\n'), program.args.join(' '));
55
+ console.log(chalk_1.default.yellow('See --help for a list of available commands.'));
56
+ process.exit(1);
57
+ });
58
+ if (!process.argv.slice(2).length) {
59
+ program.outputHelp();
60
+ }
61
+ program.parse(process.argv);
62
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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AAuB,EAAE,4BAA4B,CAAC;KAC7D,MAAM,CAAC,2BAA2B,EAAE,sBAAsB,EAAE,IAAI,CAAC;KACjE,MAAM,CAAC,mBAAmB,EAAE,iCAAiC,EAAE,MAAM,CAAC;KACtE,MAAM,CAAC,4BAAgB,CAAC,CAAC;AAE5B,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;KACtD,MAAM,CAAC,aAAa,EAAE,yBAAyB,CAAC;KAChD,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;KAC1C,MAAM,CAAC,SAAS,EAAE,gCAAgC,CAAC;KACnD,MAAM,CAAC,sBAAa,CAAC,CAAC;AAEzB,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE;IACtB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC;AAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { BenchmarkOptions } from '../types';
2
+ export declare function benchmarkCommand(options: BenchmarkOptions): Promise<void>;
3
+ //# sourceMappingURL=benchmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/commands/benchmark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAc/E"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.benchmarkCommand = benchmarkCommand;
4
+ const logger_1 = require("../utils/logger");
5
+ async function benchmarkCommand(options) {
6
+ logger_1.logger.header('Stylus Toolkit - Benchmark');
7
+ logger_1.logger.info(`Contract: ${options.contract || 'All'}`);
8
+ logger_1.logger.info(`Iterations: ${options.iterations}`);
9
+ logger_1.logger.info(`Export format: ${options.export}`);
10
+ logger_1.logger.newLine();
11
+ logger_1.logger.warn('Benchmark feature coming soon in Milestone 2!');
12
+ logger_1.logger.info('This will include:');
13
+ logger_1.logger.info(' - Multiple iteration testing');
14
+ logger_1.logger.info(' - Statistical analysis');
15
+ logger_1.logger.info(' - Performance metrics');
16
+ logger_1.logger.info(' - Advanced visualization');
17
+ }
18
+ //# sourceMappingURL=benchmark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../../src/commands/benchmark.ts"],"names":[],"mappings":";;AAGA,4CAcC;AAjBD,4CAAyC;AAGlC,KAAK,UAAU,gBAAgB,CAAC,OAAyB;IAC9D,eAAM,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC;IAE5C,eAAM,CAAC,IAAI,CAAC,aAAa,OAAO,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC;IACtD,eAAM,CAAC,IAAI,CAAC,eAAe,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACjD,eAAM,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEhD,eAAM,CAAC,OAAO,EAAE,CAAC;IACjB,eAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;IAC7D,eAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAClC,eAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAC9C,eAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACxC,eAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACvC,eAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,9 @@
1
+ interface ConfigOptions {
2
+ set?: string;
3
+ get?: string;
4
+ list?: boolean;
5
+ reset?: boolean;
6
+ }
7
+ export declare function configCommand(options: ConfigOptions): Promise<void>;
8
+ export {};
9
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgEzE"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.configCommand = configCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const logger_1 = require("../utils/logger");
9
+ const config_1 = require("../utils/config");
10
+ async function configCommand(options) {
11
+ logger_1.logger.header('Stylus Toolkit - Configuration');
12
+ if (options.set) {
13
+ const [key, ...valueParts] = options.set.split('=');
14
+ const value = valueParts.join('=');
15
+ if (!key || !value) {
16
+ logger_1.logger.error('Invalid format. Use: --set key=value');
17
+ process.exit(1);
18
+ }
19
+ config_1.config.set(key, value);
20
+ logger_1.logger.success(`Set ${key} = ${value}`);
21
+ return;
22
+ }
23
+ if (options.get) {
24
+ const value = config_1.config.get(options.get);
25
+ console.log(chalk_1.default.cyan(options.get + ':'), value);
26
+ return;
27
+ }
28
+ if (options.reset) {
29
+ config_1.config.reset();
30
+ logger_1.logger.success('Configuration reset to defaults');
31
+ return;
32
+ }
33
+ if (options.list) {
34
+ const allConfig = config_1.config.getAll();
35
+ logger_1.logger.section('Current Configuration');
36
+ logger_1.logger.table({
37
+ 'Default Network': allConfig.defaultNetwork,
38
+ 'Gas Price': allConfig.gasPrice,
39
+ 'Results Directory': allConfig.resultsDir,
40
+ });
41
+ logger_1.logger.newLine();
42
+ logger_1.logger.section('Configured Networks');
43
+ const networks = config_1.config.listNetworks();
44
+ networks.forEach((networkName) => {
45
+ const network = config_1.config.getNetwork(networkName);
46
+ if (network) {
47
+ console.log(chalk_1.default.bold(`\n${networkName}:`));
48
+ logger_1.logger.table({
49
+ 'Name': network.name,
50
+ 'RPC URL': network.rpcUrl,
51
+ 'Chain ID': network.chainId,
52
+ 'Explorer': network.explorer || 'N/A',
53
+ });
54
+ }
55
+ });
56
+ return;
57
+ }
58
+ logger_1.logger.info('Use --list to view all configuration');
59
+ logger_1.logger.info('Use --set key=value to set a configuration value');
60
+ logger_1.logger.info('Use --get key to get a configuration value');
61
+ logger_1.logger.info('Use --reset to reset to default configuration');
62
+ }
63
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":";;;;;AAWA,sCAgEC;AA3ED,kDAA0B;AAC1B,4CAAyC;AACzC,4CAAyC;AASlC,KAAK,UAAU,aAAa,CAAC,OAAsB;IACxD,eAAM,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC;IAEhD,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC,GAAG,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C,MAAM,QAAQ,GAAG,eAAM,CAAC,YAAY,EAAE,CAAC;QACvC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YAC/B,MAAM,OAAO,GAAG,eAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC/C,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,WAAW,GAAG,CAAC,CAAC,CAAC;gBAC7C,eAAM,CAAC,KAAK,CAAC;oBACX,MAAM,EAAE,OAAO,CAAC,IAAI;oBACpB,SAAS,EAAE,OAAO,CAAC,MAAM;oBACzB,UAAU,EAAE,OAAO,CAAC,OAAO;oBAC3B,UAAU,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;iBACtC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO;IACT,CAAC;IAED,eAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACpD,eAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAChE,eAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC1D,eAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { InitOptions } from '../types';
2
+ export declare function initCommand(options: InitOptions): Promise<void>;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAiB,MAAM,UAAU,CAAC;AAGtD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6HrE"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.initCommand = initCommand;
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const logger_1 = require("../utils/logger");
10
+ const file_system_1 = require("../utils/file-system");
11
+ const generator_1 = require("../templates/generator");
12
+ async function initCommand(options) {
13
+ logger_1.logger.header('Stylus Toolkit - Initialize New Project');
14
+ let projectName = options.name;
15
+ let template = options.template;
16
+ if (!projectName) {
17
+ const answers = await inquirer_1.default.prompt([
18
+ {
19
+ type: 'input',
20
+ name: 'projectName',
21
+ message: 'Project name:',
22
+ default: 'my-stylus-project',
23
+ validate: (input) => {
24
+ if (/^[a-z0-9-_]+$/i.test(input))
25
+ return true;
26
+ return 'Project name can only contain letters, numbers, hyphens, and underscores';
27
+ },
28
+ },
29
+ ]);
30
+ projectName = answers.projectName;
31
+ }
32
+ if (!template || (!options.rustOnly && !options.solidityOnly && !projectName)) {
33
+ const prompts = [];
34
+ if (!template) {
35
+ prompts.push({
36
+ type: 'list',
37
+ name: 'template',
38
+ message: 'Select a template:',
39
+ choices: [
40
+ { name: 'Basic (Empty project)', value: 'basic' },
41
+ { name: 'ERC-20 Token', value: 'erc20' },
42
+ { name: 'ERC-721 NFT', value: 'erc721' },
43
+ { name: 'DeFi Protocol', value: 'defi' },
44
+ ],
45
+ default: 'basic',
46
+ });
47
+ }
48
+ if (!options.rustOnly && !options.solidityOnly && !projectName) {
49
+ prompts.push({
50
+ type: 'checkbox',
51
+ name: 'languages',
52
+ message: 'Select languages to include:',
53
+ choices: [
54
+ { name: 'Rust (Stylus)', value: 'rust', checked: true },
55
+ { name: 'Solidity (for comparison)', value: 'solidity', checked: true },
56
+ ],
57
+ validate: (input) => {
58
+ if (input.length === 0)
59
+ return 'Select at least one language';
60
+ return true;
61
+ },
62
+ });
63
+ }
64
+ if (prompts.length > 0) {
65
+ const answers = await inquirer_1.default.prompt(prompts);
66
+ if (answers.template) {
67
+ template = answers.template;
68
+ }
69
+ if (answers.languages) {
70
+ options.rustOnly = answers.languages.includes('rust') && !answers.languages.includes('solidity');
71
+ options.solidityOnly = answers.languages.includes('solidity') && !answers.languages.includes('rust');
72
+ }
73
+ }
74
+ }
75
+ const hasRust = !options.solidityOnly;
76
+ const hasSolidity = !options.rustOnly;
77
+ logger_1.logger.startSpinner('Creating project structure...');
78
+ try {
79
+ const projectPath = await file_system_1.FileSystem.createProjectStructure(projectName, hasRust, hasSolidity);
80
+ logger_1.logger.updateSpinner('Generating template files...');
81
+ const templateGenerator = new generator_1.TemplateGenerator();
82
+ await templateGenerator.generate(projectPath, template, hasRust, hasSolidity);
83
+ const projectConfig = {
84
+ name: projectName,
85
+ version: '1.0.0',
86
+ template,
87
+ hasRust,
88
+ hasSolidity,
89
+ createdAt: new Date().toISOString(),
90
+ };
91
+ await file_system_1.FileSystem.writeJson(path_1.default.join(projectPath, '.stylus-toolkit', 'config.json'), projectConfig);
92
+ logger_1.logger.succeedSpinner('Project created successfully!');
93
+ logger_1.logger.newLine();
94
+ logger_1.logger.section('Project Details');
95
+ logger_1.logger.table({
96
+ 'Project Name': projectName,
97
+ 'Template': template,
98
+ 'Rust (Stylus)': hasRust ? 'Yes' : 'No',
99
+ 'Solidity': hasSolidity ? 'Yes' : 'No',
100
+ 'Location': projectPath,
101
+ });
102
+ logger_1.logger.newLine();
103
+ logger_1.logger.section('Next Steps');
104
+ console.log(` 1. ${logger_1.logger.info.bind(logger_1.logger)} cd ${projectName}`);
105
+ console.log(` 2. ${logger_1.logger.info.bind(logger_1.logger)} stylus-toolkit profile`);
106
+ console.log(` 3. ${logger_1.logger.info.bind(logger_1.logger)} Check the README.md for more information`);
107
+ logger_1.logger.newLine();
108
+ }
109
+ catch (error) {
110
+ logger_1.logger.failSpinner('Failed to create project');
111
+ logger_1.logger.error(error.message);
112
+ process.exit(1);
113
+ }
114
+ }
115
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../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AAC,IAAI;YACtC,UAAU,EAAE,WAAW;SACxB,CAAC,CAAC;QAEH,eAAM,CAAC,OAAO,EAAE,CAAC;QACjB,eAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,QAAQ,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAM,CAAC,OAAO,WAAW,EAAE,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,QAAQ,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAM,CAAC,yBAAyB,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,QAAQ,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAM,CAAC,2CAA2C,CAAC,CAAC;QACzF,eAAM,CAAC,OAAO,EAAE,CAAC;IAEnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;QAC/C,eAAM,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ProfileOptions } from '../types';
2
+ export declare function profileCommand(options: ProfileOptions): Promise<void>;
3
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAqH3E"}