@devaloop/devalang 0.0.1-alpha.9 → 0.0.1-beta.1

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 (271) hide show
  1. package/.cargo/config.toml +2 -0
  2. package/.devalang +10 -4
  3. package/.github/workflows/ci.yml +103 -0
  4. package/Cargo.toml +80 -48
  5. package/README.md +135 -154
  6. package/docs/CHANGELOG.md +386 -1
  7. package/docs/CONTRIBUTING.md +101 -0
  8. package/docs/ROADMAP.md +10 -7
  9. package/docs/TODO.md +21 -9
  10. package/examples/automation.deva +42 -0
  11. package/examples/bank.deva +7 -0
  12. package/examples/duration.deva +9 -0
  13. package/examples/events.deva +12 -0
  14. package/examples/function.deva +15 -0
  15. package/examples/index.deva +57 -12
  16. package/examples/loop.deva +5 -12
  17. package/examples/pattern.deva +8 -0
  18. package/examples/plugin.deva +16 -0
  19. package/examples/variables.deva +1 -1
  20. package/out-tsc/bin/index.d.ts +2 -0
  21. package/out-tsc/bin/index.js +51 -7
  22. package/out-tsc/core/functions/index.d.ts +37 -0
  23. package/out-tsc/core/functions/index.js +76 -0
  24. package/out-tsc/core/index.d.ts +6 -0
  25. package/out-tsc/core/index.js +22 -0
  26. package/out-tsc/core/types/index.d.ts +4 -0
  27. package/out-tsc/core/types/index.js +20 -0
  28. package/out-tsc/core/types/plugin.d.ts +18 -0
  29. package/out-tsc/core/types/plugin.js +2 -0
  30. package/out-tsc/core/types/result.d.ts +27 -0
  31. package/out-tsc/core/types/result.js +2 -0
  32. package/out-tsc/core/types/statement.d.ts +106 -0
  33. package/out-tsc/core/types/statement.js +2 -0
  34. package/out-tsc/core/types/value.d.ts +43 -0
  35. package/out-tsc/core/types/value.js +2 -0
  36. package/out-tsc/index.d.ts +7 -0
  37. package/out-tsc/index.js +42 -1
  38. package/out-tsc/pkg/devalang_core.d.ts +13 -0
  39. package/out-tsc/pkg/devalang_core.js +50 -0
  40. package/out-tsc/pkg/devalang_core_bg.wasm.d.ts +33 -0
  41. package/out-tsc/scripts/copy-wasm-dts.d.ts +1 -0
  42. package/out-tsc/scripts/copy-wasm-dts.js +73 -0
  43. package/out-tsc/scripts/postinstall.d.ts +1 -0
  44. package/out-tsc/scripts/postinstall.js +83 -0
  45. package/out-tsc/scripts/version/bump.d.ts +1 -0
  46. package/out-tsc/scripts/version/fetch.d.ts +1 -0
  47. package/out-tsc/scripts/version/index.d.ts +1 -0
  48. package/out-tsc/scripts/version/sync.d.ts +1 -0
  49. package/package.json +28 -7
  50. package/project-version.json +4 -4
  51. package/rust/cli/bank/api.rs +122 -0
  52. package/rust/cli/bank/commands.rs +275 -0
  53. package/rust/cli/bank/mod.rs +29 -0
  54. package/rust/cli/build/commands.rs +103 -0
  55. package/rust/cli/build/mod.rs +2 -0
  56. package/rust/cli/build/process.rs +146 -0
  57. package/rust/cli/check/mod.rs +208 -0
  58. package/rust/cli/discover/commands.rs +253 -0
  59. package/rust/cli/discover/config.rs +111 -0
  60. package/rust/cli/discover/fs.rs +19 -0
  61. package/rust/cli/discover/install.rs +103 -0
  62. package/rust/cli/discover/metadata.rs +48 -0
  63. package/rust/cli/discover/mod.rs +5 -0
  64. package/rust/cli/{init.rs → init/commands.rs} +32 -23
  65. package/rust/cli/init/mod.rs +1 -0
  66. package/rust/cli/install/addon.rs +118 -0
  67. package/rust/cli/install/bank.rs +53 -0
  68. package/rust/cli/install/commands.rs +35 -0
  69. package/rust/cli/install/mod.rs +4 -0
  70. package/rust/cli/install/plugin.rs +61 -0
  71. package/rust/cli/login/commands.rs +124 -0
  72. package/rust/cli/login/mod.rs +1 -0
  73. package/rust/cli/mod.rs +12 -205
  74. package/rust/cli/parser.rs +314 -0
  75. package/rust/cli/play/commands.rs +324 -0
  76. package/rust/cli/play/io.rs +17 -0
  77. package/rust/cli/play/mod.rs +5 -0
  78. package/rust/cli/play/process.rs +150 -0
  79. package/rust/cli/play/realtime.rs +91 -0
  80. package/rust/cli/play/utils.rs +23 -0
  81. package/rust/cli/telemetry/commands.rs +22 -0
  82. package/rust/cli/telemetry/event_creator.rs +80 -0
  83. package/rust/cli/telemetry/mod.rs +3 -0
  84. package/rust/cli/telemetry/send.rs +51 -0
  85. package/rust/cli/{template.rs → template/commands.rs} +69 -57
  86. package/rust/cli/template/mod.rs +1 -0
  87. package/rust/cli/update/commands.rs +6 -0
  88. package/rust/cli/update/mod.rs +1 -0
  89. package/rust/config/driver.rs +103 -0
  90. package/rust/config/mod.rs +3 -16
  91. package/rust/config/ops.rs +26 -0
  92. package/rust/config/settings.rs +101 -0
  93. package/rust/core/audio/engine/helpers.rs +170 -0
  94. package/rust/core/audio/engine/mod.rs +7 -0
  95. package/rust/core/audio/engine/sample.rs +366 -0
  96. package/rust/core/audio/engine/synth.rs +325 -0
  97. package/rust/core/audio/evaluator.rs +310 -31
  98. package/rust/core/audio/interpreter/arrow_call.rs +311 -129
  99. package/rust/core/audio/interpreter/automate.rs +18 -0
  100. package/rust/core/audio/interpreter/call.rs +294 -64
  101. package/rust/core/audio/interpreter/condition.rs +71 -69
  102. package/rust/core/audio/interpreter/driver.rs +542 -216
  103. package/rust/core/audio/interpreter/function.rs +26 -0
  104. package/rust/core/audio/interpreter/let_.rs +38 -19
  105. package/rust/core/audio/interpreter/load.rs +19 -18
  106. package/rust/core/audio/interpreter/loop_.rs +114 -67
  107. package/rust/core/audio/interpreter/mod.rs +14 -12
  108. package/rust/core/audio/interpreter/sleep.rs +28 -36
  109. package/rust/core/audio/interpreter/spawn.rs +252 -66
  110. package/rust/core/audio/interpreter/tempo.rs +40 -16
  111. package/rust/core/audio/interpreter/trigger.rs +239 -69
  112. package/rust/core/audio/loader/mod.rs +1 -1
  113. package/rust/core/audio/loader/trigger.rs +97 -52
  114. package/rust/core/audio/mod.rs +7 -6
  115. package/rust/core/audio/player.rs +70 -54
  116. package/rust/core/audio/renderer.rs +54 -54
  117. package/rust/core/audio/special/easing.rs +189 -0
  118. package/rust/core/audio/special/env.rs +45 -0
  119. package/rust/core/audio/special/math.rs +134 -0
  120. package/rust/core/audio/special/mod.rs +9 -0
  121. package/rust/core/audio/special/modulator.rs +143 -0
  122. package/rust/core/builder/mod.rs +86 -80
  123. package/rust/core/debugger/lexer.rs +27 -27
  124. package/rust/core/debugger/mod.rs +30 -21
  125. package/rust/core/debugger/module.rs +55 -0
  126. package/rust/core/debugger/preprocessor.rs +27 -27
  127. package/rust/core/debugger/store.rs +40 -25
  128. package/rust/core/error/mod.rs +269 -60
  129. package/rust/core/lexer/driver.rs +61 -0
  130. package/rust/core/lexer/handler/arrow.rs +82 -31
  131. package/rust/core/lexer/handler/at.rs +21 -21
  132. package/rust/core/lexer/handler/brace.rs +41 -41
  133. package/rust/core/lexer/handler/colon.rs +21 -21
  134. package/rust/core/lexer/handler/comment.rs +30 -30
  135. package/rust/core/lexer/handler/dot.rs +21 -21
  136. package/rust/core/lexer/handler/driver.rs +337 -226
  137. package/rust/core/lexer/handler/identifier.rs +47 -41
  138. package/rust/core/lexer/handler/indent.rs +66 -52
  139. package/rust/core/lexer/handler/mod.rs +15 -14
  140. package/rust/core/lexer/handler/newline.rs +23 -23
  141. package/rust/core/lexer/handler/number.rs +31 -31
  142. package/rust/core/lexer/handler/operator.rs +46 -44
  143. package/rust/core/lexer/handler/parenthesis.rs +41 -0
  144. package/rust/core/lexer/handler/slash.rs +21 -0
  145. package/rust/core/lexer/handler/string.rs +63 -63
  146. package/rust/core/lexer/mod.rs +3 -51
  147. package/rust/core/lexer/token.rs +17 -12
  148. package/rust/core/mod.rs +10 -10
  149. package/rust/core/parser/driver.rs +584 -331
  150. package/rust/core/parser/handler/arrow_call.rs +253 -126
  151. package/rust/core/parser/handler/at.rs +279 -162
  152. package/rust/core/parser/handler/bank.rs +104 -41
  153. package/rust/core/parser/handler/condition.rs +83 -74
  154. package/rust/core/parser/handler/dot.rs +148 -112
  155. package/rust/core/parser/handler/identifier/automate.rs +254 -0
  156. package/rust/core/parser/handler/identifier/call.rs +91 -41
  157. package/rust/core/parser/handler/identifier/emit.rs +70 -0
  158. package/rust/core/parser/handler/identifier/function.rs +113 -0
  159. package/rust/core/parser/handler/identifier/group.rs +89 -75
  160. package/rust/core/parser/handler/identifier/let_.rs +173 -133
  161. package/rust/core/parser/handler/identifier/mod.rs +55 -51
  162. package/rust/core/parser/handler/identifier/on.rs +107 -0
  163. package/rust/core/parser/handler/identifier/print.rs +49 -0
  164. package/rust/core/parser/handler/identifier/sleep.rs +43 -33
  165. package/rust/core/parser/handler/identifier/spawn.rs +91 -41
  166. package/rust/core/parser/handler/identifier/synth.rs +135 -65
  167. package/rust/core/parser/handler/loop_.rs +194 -72
  168. package/rust/core/parser/handler/mod.rs +9 -8
  169. package/rust/core/parser/handler/pattern.rs +74 -0
  170. package/rust/core/parser/handler/tempo.rs +57 -47
  171. package/rust/core/parser/mod.rs +3 -4
  172. package/rust/core/parser/statement.rs +11 -96
  173. package/rust/core/plugin/loader.rs +137 -0
  174. package/rust/core/plugin/mod.rs +2 -0
  175. package/rust/core/plugin/runner.rs +347 -0
  176. package/rust/core/preprocessor/loader.rs +637 -193
  177. package/rust/core/preprocessor/mod.rs +4 -4
  178. package/rust/core/preprocessor/module.rs +60 -50
  179. package/rust/core/preprocessor/processor.rs +114 -76
  180. package/rust/core/preprocessor/resolver/bank.rs +49 -47
  181. package/rust/core/preprocessor/resolver/call.rs +124 -123
  182. package/rust/core/preprocessor/resolver/condition.rs +95 -92
  183. package/rust/core/preprocessor/resolver/driver.rs +324 -227
  184. package/rust/core/preprocessor/resolver/function.rs +69 -0
  185. package/rust/core/preprocessor/resolver/group.rs +94 -61
  186. package/rust/core/preprocessor/resolver/let_.rs +32 -31
  187. package/rust/core/preprocessor/resolver/loop_.rs +318 -91
  188. package/rust/core/preprocessor/resolver/mod.rs +16 -14
  189. package/rust/core/preprocessor/resolver/pattern.rs +83 -0
  190. package/rust/core/preprocessor/resolver/spawn.rs +99 -58
  191. package/rust/core/preprocessor/resolver/synth.rs +54 -50
  192. package/rust/core/preprocessor/resolver/tempo.rs +48 -49
  193. package/rust/core/preprocessor/resolver/trigger.rs +116 -112
  194. package/rust/core/preprocessor/resolver/value.rs +176 -78
  195. package/rust/core/store/export.rs +28 -28
  196. package/rust/core/store/function.rs +40 -0
  197. package/rust/core/store/global.rs +61 -39
  198. package/rust/core/store/import.rs +28 -28
  199. package/rust/core/store/mod.rs +5 -4
  200. package/rust/core/store/variable.rs +51 -28
  201. package/rust/core/utils/mod.rs +1 -2
  202. package/rust/core/utils/path.rs +37 -31
  203. package/rust/lib.rs +308 -117
  204. package/rust/main.rs +364 -65
  205. package/rust/types/Cargo.toml +11 -0
  206. package/rust/types/src/addons.rs +55 -0
  207. package/rust/types/src/ast.rs +202 -0
  208. package/rust/types/src/config.rs +74 -0
  209. package/rust/types/src/lib.rs +12 -0
  210. package/rust/types/src/telemetry.rs +85 -0
  211. package/rust/utils/Cargo.toml +26 -0
  212. package/rust/utils/src/error.rs +186 -0
  213. package/rust/utils/src/file.rs +94 -0
  214. package/rust/utils/src/first_usage.rs +97 -0
  215. package/rust/utils/{mod.rs → src/lib.rs} +9 -6
  216. package/rust/utils/{logger.rs → src/logger.rs} +200 -123
  217. package/rust/utils/src/path.rs +88 -0
  218. package/rust/utils/src/signature.rs +41 -0
  219. package/rust/utils/{spinner.rs → src/spinner.rs} +20 -21
  220. package/rust/utils/src/version.rs +27 -0
  221. package/rust/utils/{watcher.rs → src/watcher.rs} +46 -33
  222. package/rust/web/api.rs +5 -0
  223. package/rust/web/cdn.rs +34 -0
  224. package/rust/web/mod.rs +3 -0
  225. package/rust/web/sso.rs +5 -0
  226. package/templates/minimal/README.md +143 -127
  227. package/templates/welcome/README.md +143 -127
  228. package/templates/welcome/src/index.deva +56 -8
  229. package/templates/welcome/src/variables.deva +2 -4
  230. package/tests/integration.rs +21 -0
  231. package/tests/rust/cli_check_build.rs +21 -0
  232. package/tests/rust/cli_help.rs +12 -0
  233. package/tests/rust/cli_template_list.rs +10 -0
  234. package/tests/rust/cli_version.rs +11 -0
  235. package/tests/typescript/index.spec.ts +136 -0
  236. package/tests/typescript/playhead.spec.ts +36 -0
  237. package/tests/typescript/render_e2e.spec.ts +77 -0
  238. package/tsconfig.json +12 -10
  239. package/typescript/bin/index.ts +19 -5
  240. package/typescript/core/functions/index.ts +83 -0
  241. package/typescript/core/index.ts +6 -0
  242. package/typescript/core/types/index.ts +4 -0
  243. package/typescript/core/types/plugin.ts +19 -0
  244. package/typescript/core/types/result.ts +29 -0
  245. package/typescript/core/types/statement.ts +47 -0
  246. package/typescript/core/types/value.ts +29 -0
  247. package/typescript/index.ts +8 -1
  248. package/typescript/pkg/devalang_core.d.ts +4 -0
  249. package/typescript/pkg/devalang_core.ts +49 -0
  250. package/typescript/scripts/copy-wasm-dts.ts +41 -0
  251. package/typescript/scripts/postinstall.ts +85 -0
  252. package/typescript/scripts/version/bump.ts +0 -1
  253. package/typescript/scripts/version/index.ts +0 -1
  254. package/docs/COMMANDS.md +0 -85
  255. package/docs/CONFIG.md +0 -30
  256. package/docs/SYNTAX.md +0 -210
  257. package/out-tsc/bin/devalang.exe +0 -0
  258. package/out-tsc/scripts/postbuild.js +0 -11
  259. package/rust/cli/build.rs +0 -137
  260. package/rust/cli/check.rs +0 -117
  261. package/rust/cli/play.rs +0 -193
  262. package/rust/config/loader.rs +0 -13
  263. package/rust/core/audio/engine.rs +0 -203
  264. package/rust/core/shared/duration.rs +0 -8
  265. package/rust/core/shared/mod.rs +0 -2
  266. package/rust/core/shared/value.rs +0 -18
  267. package/rust/core/utils/validation.rs +0 -37
  268. package/rust/utils/file.rs +0 -35
  269. package/rust/utils/signature.rs +0 -17
  270. package/rust/utils/version.rs +0 -15
  271. package/typescript/scripts/postbuild.ts +0 -8
package/rust/cli/mod.rs CHANGED
@@ -1,205 +1,12 @@
1
- pub mod check;
2
- pub mod build;
3
- pub mod init;
4
- pub mod template;
5
- pub mod play;
6
-
7
- use clap::{ Parser, Subcommand };
8
- use crate::utils::version::get_version;
9
-
10
- #[derive(Parser)]
11
- #[command(name = "devalang")]
12
- #[command(author = "Devaloop")]
13
- #[command(version = get_version())]
14
- #[command(about = "🦊 Devalang – A programming language for music and sound.")]
15
- pub struct Cli {
16
- #[arg(long, global = true)]
17
- /// Skips loading the configuration file.
18
- pub no_config: bool,
19
-
20
- #[command(subcommand)]
21
- pub command: Commands,
22
- }
23
-
24
- #[derive(Subcommand)]
25
- pub enum TemplateCommand {
26
- /// Lists all available templates for Devalang projects.
27
- List,
28
- /// Displays information about a specific template.
29
- Info {
30
- name: String,
31
- },
32
- }
33
-
34
- #[derive(Subcommand)]
35
- pub enum Commands {
36
- /// Create a new Devalang project.
37
- ///
38
- /// ### Arguments
39
- /// - `name` - The name of the project to create.
40
- /// - `template` - The template to use for the project. Defaults to "default".
41
- ///
42
- /// ### Example
43
- /// ```bash
44
- /// devalang init --name my_project --template default
45
- ///
46
- Init {
47
- #[arg(short, long)]
48
- /// The optional name (directory) of the project to create.
49
- name: Option<String>,
50
-
51
- #[arg(short, long)]
52
- /// The template to use for the project.
53
- ///
54
- /// ### Default value
55
- /// - `default`
56
- ///
57
- template: Option<String>,
58
- },
59
-
60
- Template {
61
- #[command(subcommand)]
62
- /// The template command to execute.
63
- command: TemplateCommand,
64
- },
65
-
66
- /// Build the program and generate output files.
67
- ///
68
- /// ### Arguments
69
- /// - `entry` - The entry point of the program to build. Defaults to "./src".
70
- /// - `output` - The directory where the output files will be generated. Defaults to "./output".
71
- /// - `watch` - Whether to watch for changes and rebuild. Defaults to "true".
72
- ///
73
- /// ### Example
74
- /// ```bash
75
- /// devalang build --entry ./src --output ./output --watch true
76
- /// ```
77
- ///
78
- Build {
79
- #[arg(short, long)]
80
- /// The entry point of the program to build.
81
- ///
82
- entry: Option<String>,
83
-
84
- #[arg(short, long)]
85
- /// The directory where the output files will be generated.
86
- ///
87
- output: Option<String>,
88
-
89
- #[arg(long, default_value_t = false)]
90
- /// Whether to watch for changes and rebuild.
91
- ///
92
- /// ### Default value
93
- /// - `false`
94
- ///
95
- watch: bool,
96
-
97
- #[arg(long, default_value = "real-time")]
98
- /// The mode of compilation.
99
- ///
100
- /// ### Default value
101
- /// - `real-time`
102
- ///
103
- /// ### Possible values
104
- /// - `real-time` - Compiles files as soon as possible.
105
- /// - `batch` - Compiles files one by one.
106
- /// - `check` - Analyzes the code without compiling it.
107
- ///
108
- compilation_mode: String,
109
-
110
- #[arg(short, long, default_value_t = false)]
111
- /// Whether to print debug information.
112
- ///
113
- /// ### Default value
114
- /// - `false`
115
- ///
116
- debug: bool,
117
-
118
- #[arg(short, long, default_value_t = false)]
119
- /// Whether to compress the output files.
120
- ///
121
- /// ### Default value
122
- /// - `false`
123
- ///
124
- compress: bool,
125
- },
126
-
127
- /// Analyze the program for errors and warnings.
128
- ///
129
- /// ### Arguments
130
- /// - `entry` - The entry point of the program to analyze. Defaults to "./src".
131
- /// - `watch` - Whether to watch for changes and re-analyze. Defaults to "true".
132
- ///
133
- /// ### Example
134
- /// ```bash
135
- /// devalang check --entry ./src --watch true --compilation-mode real-time
136
- /// ```
137
- Check {
138
- #[arg(short, long)]
139
- /// The entry point of the program to analyze.
140
- ///
141
- entry: Option<String>,
142
-
143
- #[arg(short, long)]
144
- /// The directory where the output files will be generated.
145
- ///
146
- output: Option<String>,
147
-
148
- #[arg(long, default_value_t = false)]
149
- /// Whether to watch for changes and re-analyze.
150
- ///
151
- /// ### Default value
152
- /// - `false`
153
- ///
154
- watch: bool,
155
-
156
- #[arg(short, long, default_value = "real-time")]
157
- /// The mode of compilation.
158
- ///
159
- /// ### Default value
160
- /// - `real-time`
161
- ///
162
- /// ### Possible values
163
- /// - `real-time` - Analyzes files as soon as possible.
164
- /// - `batch` - Analyzes files one by one.
165
- /// - `check` - Analyzes the code without compiling it.
166
- ///
167
- compilation_mode: String,
168
-
169
- #[arg(short, long, default_value_t = false)]
170
- /// Whether to print debug information.
171
- ///
172
- /// ### Default value
173
- /// - `false`
174
- ///
175
- debug: bool,
176
- },
177
-
178
- Play {
179
- #[arg(short, long)]
180
- /// The entry point of the program to play.
181
- ///
182
- entry: Option<String>,
183
-
184
- #[arg(short, long)]
185
- /// The directory where the output files will be generated.
186
- ///
187
- output: Option<String>,
188
-
189
- #[arg(long, default_value_t = false)]
190
- /// Whether to watch for changes and re-play.
191
- ///
192
- /// ### Default value
193
- /// - `false`
194
- ///
195
- watch: bool,
196
-
197
- #[arg(long, default_value_t = false)]
198
- /// Whether to replay the program after it finishes.
199
- ///
200
- /// ### Default value
201
- /// - `false`
202
- ///
203
- repeat: bool,
204
- },
205
- }
1
+ pub mod bank;
2
+ pub mod build;
3
+ pub mod check;
4
+ pub mod discover;
5
+ pub mod init;
6
+ pub mod install;
7
+ pub mod login;
8
+ pub mod parser;
9
+ pub mod play;
10
+ pub mod telemetry;
11
+ pub mod template;
12
+ pub mod update;
@@ -0,0 +1,314 @@
1
+ use clap::{Parser, Subcommand};
2
+
3
+ #[derive(Parser)]
4
+ #[command(name = "devalang")]
5
+ #[command(author = "Devaloop")]
6
+ #[command(about = "🦊 Devalang – A programming language for music and sound.")]
7
+ pub struct Cli {
8
+ #[arg(long, global = true)]
9
+ /// Skips loading the configuration file.
10
+ pub no_config: bool,
11
+
12
+ #[command(subcommand)]
13
+ pub command: Commands,
14
+ }
15
+
16
+ #[derive(Subcommand)]
17
+ pub enum TelemetryCommand {
18
+ /// Enables telemetry data collection.
19
+ Enable {},
20
+ /// Disables telemetry data collection.
21
+ Disable {},
22
+ }
23
+
24
+ #[derive(Subcommand)]
25
+ pub enum InstallCommand {
26
+ /// Installs a template.
27
+ Template { name: String },
28
+ /// Installs a bank.
29
+ Bank { name: String },
30
+ /// Installs a plugin.
31
+ Plugin { name: String },
32
+ /// Installs a preset.
33
+ Preset { name: String },
34
+ }
35
+
36
+ #[derive(Subcommand)]
37
+ pub enum TemplateCommand {
38
+ /// Lists all available templates for Devalang projects.
39
+ List,
40
+ /// Displays information about a specific template.
41
+ Info { name: String },
42
+ }
43
+
44
+ #[derive(Subcommand)]
45
+ pub enum BankCommand {
46
+ /// Lists installed banks.
47
+ List,
48
+ /// Lists all available banks.
49
+ Available,
50
+ /// Displays information about a specific bank.
51
+ Info { name: String },
52
+ /// Removes a bank.
53
+ Remove { name: String },
54
+ /// Updates a specific or all banks.
55
+ Update { name: Option<String> },
56
+ }
57
+
58
+ #[derive(Subcommand)]
59
+ pub enum Commands {
60
+ /// Create a new Devalang project.
61
+ ///
62
+ /// ### Arguments
63
+ /// - `name` - The name of the project to create.
64
+ /// - `template` - The template to use for the project. Defaults to "default".
65
+ ///
66
+ /// ### Example
67
+ /// ```bash
68
+ /// devalang init --name my_project --template default
69
+ ///
70
+ Init {
71
+ #[arg(short, long)]
72
+ /// The optional name (directory) of the project to create.
73
+ name: Option<String>,
74
+
75
+ #[arg(short, long)]
76
+ /// The template to use for the project.
77
+ ///
78
+ /// ### Default value
79
+ /// - `default`
80
+ ///
81
+ template: Option<String>,
82
+ },
83
+
84
+ /// Manage templates for Devalang projects.
85
+ ///
86
+ /// ### Subcommands
87
+ /// - `list` - Lists all available templates.
88
+ /// - `info <name>` - Displays information about a specific template.
89
+ ///
90
+ /// ### Example
91
+ /// ```bash
92
+ /// devalang template list
93
+ /// devalang template info my_template
94
+ /// ```bash
95
+ ///
96
+ Template {
97
+ #[command(subcommand)]
98
+ /// The template command to execute.
99
+ command: TemplateCommand,
100
+ },
101
+
102
+ /// Build the program and generate output files.
103
+ ///
104
+ /// ### Arguments
105
+ /// - `entry` - The entry point of the program to build. Defaults to "./src".
106
+ /// - `output` - The directory where the output files will be generated. Defaults to "./output".
107
+ /// - `watch` - Whether to watch for changes and rebuild. Defaults to "true".
108
+ /// - `debug` - Whether to print debug information. Defaults to "false".
109
+ /// - `compress` - Whether to compress the output files. Defaults to "false".
110
+ ///
111
+ /// ### Example
112
+ /// ```bash
113
+ /// devalang build --entry ./src --output ./output --watch true --debug false --compress false
114
+ /// ```
115
+ ///
116
+ Build {
117
+ #[arg(short, long)]
118
+ /// The entry point of the program to build.
119
+ ///
120
+ entry: Option<String>,
121
+
122
+ #[arg(short, long)]
123
+ /// The directory where the output files will be generated.
124
+ ///
125
+ output: Option<String>,
126
+
127
+ #[arg(long, default_value_t = false)]
128
+ /// Whether to watch for changes and rebuild.
129
+ ///
130
+ /// ### Default value
131
+ /// - `false`
132
+ ///
133
+ watch: bool,
134
+
135
+ #[arg(short, long, default_value_t = false)]
136
+ /// Whether to print debug information.
137
+ ///
138
+ /// ### Default value
139
+ /// - `false`
140
+ ///
141
+ debug: bool,
142
+
143
+ #[arg(short, long, default_value_t = false)]
144
+ /// Whether to compress the output files.
145
+ ///
146
+ /// ### Default value
147
+ /// - `false`
148
+ ///
149
+ compress: bool,
150
+ },
151
+
152
+ /// Analyze the program for errors and warnings.
153
+ ///
154
+ /// ### Arguments
155
+ /// - `entry` - The entry point of the program to analyze. Defaults to "./src".
156
+ /// - `output` - The directory where the output files will be generated. Defaults to "./output".
157
+ /// - `watch` - Whether to watch for changes and re-analyze. Defaults to "true".
158
+ /// - `debug` - Whether to print debug information. Defaults to "false".
159
+ ///
160
+ /// ### Example
161
+ /// ```bash
162
+ /// devalang check --entry ./src --output ./output --watch true --debug false
163
+ /// ```
164
+ ///
165
+ Check {
166
+ #[arg(short, long)]
167
+ /// The entry point of the program to analyze.
168
+ entry: Option<String>,
169
+
170
+ #[arg(short, long)]
171
+ /// The directory where the output files will be generated.
172
+ output: Option<String>,
173
+
174
+ #[arg(long, default_value_t = false)]
175
+ /// Whether to watch for changes and re-analyze.
176
+ ///
177
+ /// ### Default value
178
+ /// - `false`
179
+ ///
180
+ watch: bool,
181
+
182
+ #[arg(short, long, default_value_t = false)]
183
+ /// Whether to print debug information.
184
+ ///
185
+ /// ### Default value
186
+ /// - `false`
187
+ ///
188
+ debug: bool,
189
+ },
190
+
191
+ /// Play the program and generate output files.
192
+ ///
193
+ /// ### Arguments
194
+ /// - `entry` - The entry point of the program to play. Defaults to "./src".
195
+ /// - `output` - The directory where the output files will be generated. Defaults to "./output".
196
+ /// - `watch` - Whether to watch for changes and re-play. Defaults to "false".
197
+ /// - `repeat` - Whether to replay the program after it finishes. Defaults to "false".
198
+ /// - `debug` - Whether to print debug information. Defaults to "false".
199
+ ///
200
+ /// Note: `--repeat` and `--watch` cannot be used together. Instead use `repeat` to watch for changes and replay the program.
201
+ ///
202
+ /// ### Example
203
+ /// ```bash
204
+ /// devalang play --entry ./src --output ./output --repeat true --debug false
205
+ /// ```
206
+ ///
207
+ Play {
208
+ #[arg(short, long)]
209
+ /// The entry point of the program to play.
210
+ entry: Option<String>,
211
+
212
+ #[arg(short, long)]
213
+ /// The directory where the output files will be generated.
214
+ output: Option<String>,
215
+
216
+ #[arg(long, default_value_t = false)]
217
+ /// Whether to watch for changes and re-play.
218
+ ///
219
+ /// ### Default value
220
+ /// - `false`
221
+ ///
222
+ watch: bool,
223
+
224
+ #[arg(long, default_value_t = false)]
225
+ /// Whether to replay the program after it finishes.
226
+ ///
227
+ /// ### Default value
228
+ /// - `false`
229
+ ///
230
+ repeat: bool,
231
+
232
+ #[arg(short, long, default_value_t = false)]
233
+ /// Whether to print debug information.
234
+ ///
235
+ /// ### Default value
236
+ /// - `false`
237
+ ///
238
+ debug: bool,
239
+ },
240
+
241
+ /// Update the Devalang CLI to the latest version.
242
+ ///
243
+ /// ### Arguments
244
+ /// - `only` - Selects what to update (separated by commas). Defaults to updating all components.
245
+ ///
246
+ Update {
247
+ // #[arg(long, default_value_t = false)]
248
+ /// Whether to allow updates when the working directory is dirty.
249
+ // allow_dirty: bool,
250
+
251
+ #[arg(long, default_value = "")]
252
+ /// Selects what to update (separated by commas).
253
+ only: Option<String>,
254
+ },
255
+
256
+ /// Install templates, banks, or plugins.
257
+ ///
258
+ /// ### Subcommands
259
+ /// - `template` - Installs a template.
260
+ /// - `bank` - Installs a bank.
261
+ /// - `plugin` - Installs a plugin.
262
+ /// - `preset` - Installs a preset.
263
+ ///
264
+ Install {
265
+ #[command(subcommand)]
266
+ command: InstallCommand,
267
+ },
268
+
269
+ /// Discover available local addons for Devalang.
270
+ ///
271
+ Discover {},
272
+
273
+ /// Manage banks for Devalang projects.
274
+ ///
275
+ /// ### Subcommands
276
+ /// - `list` - Lists all available banks.
277
+ /// - `info <name>` - Displays information about a specific bank.
278
+ ///
279
+ Bank {
280
+ #[command(subcommand)]
281
+ command: BankCommand,
282
+ },
283
+
284
+ /// Telemetry settings for Devalang.
285
+ ///
286
+ /// ### Subcommands
287
+ /// - `enable` - Enables telemetry data collection.
288
+ /// - `disable` - Disables telemetry data collection.
289
+ ///
290
+ Telemetry {
291
+ #[command(subcommand)]
292
+ command: TelemetryCommand,
293
+ },
294
+
295
+ /// Generate addon scaffolding for Devalang.
296
+ ///
297
+ /// ### Subcommands
298
+ /// - `bank` - Generates a bank scaffold.
299
+ /// - `plugin` - Generates a plugin scaffold.
300
+ /// - `preset` - Generates a preset scaffold.
301
+ ///
302
+ // Scaffold {
303
+ // #[command(subcommand)]
304
+ // command: ScaffoldCommand,
305
+ // },
306
+
307
+ /// Log in to your Devaloop account.
308
+ ///
309
+ Login {},
310
+
311
+ /// Log out of your Devaloop account.
312
+ ///
313
+ Logout {},
314
+ }