@ball-lang/cli 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.
@@ -0,0 +1,337 @@
1
+ /**
2
+ * Static mapping of every Ball base function to its capability category.
3
+ *
4
+ * Since every side effect in Ball flows through a named base function in a
5
+ * known module, this table is provably complete. No function can perform I/O,
6
+ * access the filesystem, or spawn threads without appearing here.
7
+ *
8
+ * Ported from `dart/shared/lib/capability_table.dart`.
9
+ */
10
+ /** Canonical ordering of capabilities (matches the Dart enum order). */
11
+ export const ALL_CAPABILITIES = [
12
+ 'pure',
13
+ 'io',
14
+ 'fs',
15
+ 'process',
16
+ 'time',
17
+ 'random',
18
+ 'memory',
19
+ 'concurrency',
20
+ 'network',
21
+ 'async',
22
+ ];
23
+ /** Risk level associated with each capability. */
24
+ export const capabilityRiskLevel = {
25
+ pure: 'none',
26
+ io: 'low',
27
+ fs: 'medium',
28
+ process: 'high',
29
+ time: 'low',
30
+ random: 'low',
31
+ memory: 'high',
32
+ concurrency: 'medium',
33
+ network: 'high',
34
+ async: 'low',
35
+ };
36
+ /**
37
+ * Lookup the capability of a base function call.
38
+ *
39
+ * Returns `undefined` for non-base / user-defined functions (which are pure
40
+ * by construction — they can only call other functions in this table).
41
+ */
42
+ export function lookupCapability(module, fn) {
43
+ return CAPABILITY_TABLE[`${module}.${fn}`];
44
+ }
45
+ export const CAPABILITY_TABLE = {
46
+ // ── std: print ──
47
+ 'std.print': 'io',
48
+ // ── std: arithmetic (pure) ──
49
+ 'std.add': 'pure',
50
+ 'std.subtract': 'pure',
51
+ 'std.multiply': 'pure',
52
+ 'std.divide': 'pure',
53
+ 'std.divide_double': 'pure',
54
+ 'std.modulo': 'pure',
55
+ 'std.negate': 'pure',
56
+ // ── std: comparison (pure) ──
57
+ 'std.equals': 'pure',
58
+ 'std.not_equals': 'pure',
59
+ 'std.less_than': 'pure',
60
+ 'std.greater_than': 'pure',
61
+ 'std.lte': 'pure',
62
+ 'std.gte': 'pure',
63
+ // ── std: logical (pure) ──
64
+ 'std.and': 'pure',
65
+ 'std.or': 'pure',
66
+ 'std.not': 'pure',
67
+ // ── std: bitwise (pure) ──
68
+ 'std.bitwise_and': 'pure',
69
+ 'std.bitwise_or': 'pure',
70
+ 'std.bitwise_xor': 'pure',
71
+ 'std.bitwise_not': 'pure',
72
+ 'std.left_shift': 'pure',
73
+ 'std.right_shift': 'pure',
74
+ 'std.unsigned_right_shift': 'pure',
75
+ // ── std: increment/decrement (pure) ──
76
+ 'std.pre_increment': 'pure',
77
+ 'std.pre_decrement': 'pure',
78
+ 'std.post_increment': 'pure',
79
+ 'std.post_decrement': 'pure',
80
+ // ── std: string & conversion (pure) ──
81
+ 'std.concat': 'pure',
82
+ 'std.length': 'pure',
83
+ 'std.to_string': 'pure',
84
+ 'std.int_to_string': 'pure',
85
+ 'std.double_to_string': 'pure',
86
+ 'std.string_to_int': 'pure',
87
+ 'std.string_to_double': 'pure',
88
+ // ── std: null safety (pure) ──
89
+ 'std.null_coalesce': 'pure',
90
+ 'std.null_check': 'pure',
91
+ // ── std: control flow (pure) ──
92
+ 'std.if': 'pure',
93
+ 'std.for': 'pure',
94
+ 'std.for_in': 'pure',
95
+ 'std.while': 'pure',
96
+ 'std.do_while': 'pure',
97
+ 'std.switch': 'pure',
98
+ // ── std: error handling (pure) ──
99
+ 'std.try': 'pure',
100
+ 'std.throw': 'pure',
101
+ 'std.rethrow': 'pure',
102
+ // ── std: assertions (pure) ──
103
+ 'std.assert': 'pure',
104
+ // ── std: flow control (pure) ──
105
+ 'std.return': 'pure',
106
+ 'std.break': 'pure',
107
+ 'std.continue': 'pure',
108
+ // ── std: generators & async ──
109
+ 'std.yield': 'async',
110
+ 'std.yield_each': 'async',
111
+ 'std.await': 'async',
112
+ 'std.async': 'async',
113
+ // ── std: assignment (pure) ──
114
+ 'std.assign': 'pure',
115
+ 'std.compound_assign': 'pure',
116
+ // ── std: type operations (pure) ──
117
+ 'std.is': 'pure',
118
+ 'std.is_not': 'pure',
119
+ 'std.as': 'pure',
120
+ // ── std: indexing (pure) ──
121
+ 'std.index': 'pure',
122
+ 'std.index_assign': 'pure',
123
+ // ── std: labels (pure) ──
124
+ 'std.labeled': 'pure',
125
+ 'std.label': 'pure',
126
+ 'std.goto': 'pure',
127
+ 'std.paren': 'pure',
128
+ // ── std: string operations (pure) ──
129
+ 'std.string_length': 'pure',
130
+ 'std.string_is_empty': 'pure',
131
+ 'std.string_concat': 'pure',
132
+ 'std.string_contains': 'pure',
133
+ 'std.string_starts_with': 'pure',
134
+ 'std.string_ends_with': 'pure',
135
+ 'std.string_index_of': 'pure',
136
+ 'std.string_last_index_of': 'pure',
137
+ 'std.string_substring': 'pure',
138
+ 'std.string_char_at': 'pure',
139
+ 'std.string_char_code_at': 'pure',
140
+ 'std.string_from_char_code': 'pure',
141
+ 'std.string_to_upper': 'pure',
142
+ 'std.string_to_lower': 'pure',
143
+ 'std.string_trim': 'pure',
144
+ 'std.string_trim_start': 'pure',
145
+ 'std.string_trim_end': 'pure',
146
+ 'std.string_replace': 'pure',
147
+ 'std.string_replace_all': 'pure',
148
+ 'std.string_split': 'pure',
149
+ 'std.string_repeat': 'pure',
150
+ 'std.string_pad_left': 'pure',
151
+ 'std.string_pad_right': 'pure',
152
+ 'std.string_interpolation': 'pure',
153
+ // ── std: regex (pure) ──
154
+ 'std.regex_match': 'pure',
155
+ 'std.regex_find': 'pure',
156
+ 'std.regex_find_all': 'pure',
157
+ 'std.regex_replace': 'pure',
158
+ 'std.regex_replace_all': 'pure',
159
+ // ── std: math (pure) ──
160
+ 'std.math_abs': 'pure',
161
+ 'std.math_floor': 'pure',
162
+ 'std.math_ceil': 'pure',
163
+ 'std.math_round': 'pure',
164
+ 'std.math_trunc': 'pure',
165
+ 'std.math_sqrt': 'pure',
166
+ 'std.math_pow': 'pure',
167
+ 'std.math_log': 'pure',
168
+ 'std.math_log2': 'pure',
169
+ 'std.math_log10': 'pure',
170
+ 'std.math_exp': 'pure',
171
+ 'std.math_sin': 'pure',
172
+ 'std.math_cos': 'pure',
173
+ 'std.math_tan': 'pure',
174
+ 'std.math_asin': 'pure',
175
+ 'std.math_acos': 'pure',
176
+ 'std.math_atan': 'pure',
177
+ 'std.math_atan2': 'pure',
178
+ 'std.math_min': 'pure',
179
+ 'std.math_max': 'pure',
180
+ 'std.math_clamp': 'pure',
181
+ 'std.math_pi': 'pure',
182
+ 'std.math_e': 'pure',
183
+ 'std.math_infinity': 'pure',
184
+ 'std.math_nan': 'pure',
185
+ 'std.math_is_nan': 'pure',
186
+ 'std.math_is_finite': 'pure',
187
+ 'std.math_is_infinite': 'pure',
188
+ 'std.math_sign': 'pure',
189
+ 'std.math_gcd': 'pure',
190
+ 'std.math_lcm': 'pure',
191
+ // ── std_io ──
192
+ 'std_io.print_error': 'io',
193
+ 'std_io.read_line': 'io',
194
+ 'std_io.exit': 'process',
195
+ 'std_io.panic': 'process',
196
+ 'std_io.sleep_ms': 'time',
197
+ 'std_io.timestamp_ms': 'time',
198
+ 'std_io.random_int': 'random',
199
+ 'std_io.random_double': 'random',
200
+ 'std_io.env_get': 'io',
201
+ 'std_io.args_get': 'io',
202
+ // ── std_fs ──
203
+ 'std_fs.file_read': 'fs',
204
+ 'std_fs.file_read_bytes': 'fs',
205
+ 'std_fs.file_write': 'fs',
206
+ 'std_fs.file_write_bytes': 'fs',
207
+ 'std_fs.file_append': 'fs',
208
+ 'std_fs.file_exists': 'fs',
209
+ 'std_fs.file_delete': 'fs',
210
+ 'std_fs.dir_list': 'fs',
211
+ 'std_fs.dir_create': 'fs',
212
+ 'std_fs.dir_exists': 'fs',
213
+ // ── std_collections (all pure) ──
214
+ 'std_collections.list_push': 'pure',
215
+ 'std_collections.list_pop': 'pure',
216
+ 'std_collections.list_insert': 'pure',
217
+ 'std_collections.list_remove_at': 'pure',
218
+ 'std_collections.list_get': 'pure',
219
+ 'std_collections.list_set': 'pure',
220
+ 'std_collections.list_length': 'pure',
221
+ 'std_collections.list_is_empty': 'pure',
222
+ 'std_collections.list_first': 'pure',
223
+ 'std_collections.list_last': 'pure',
224
+ 'std_collections.list_single': 'pure',
225
+ 'std_collections.list_contains': 'pure',
226
+ 'std_collections.list_index_of': 'pure',
227
+ 'std_collections.list_map': 'pure',
228
+ 'std_collections.list_filter': 'pure',
229
+ 'std_collections.list_reduce': 'pure',
230
+ 'std_collections.list_find': 'pure',
231
+ 'std_collections.list_any': 'pure',
232
+ 'std_collections.list_all': 'pure',
233
+ 'std_collections.list_none': 'pure',
234
+ 'std_collections.list_sort': 'pure',
235
+ 'std_collections.list_sort_by': 'pure',
236
+ 'std_collections.list_reverse': 'pure',
237
+ 'std_collections.list_slice': 'pure',
238
+ 'std_collections.list_flat_map': 'pure',
239
+ 'std_collections.list_zip': 'pure',
240
+ 'std_collections.list_take': 'pure',
241
+ 'std_collections.list_drop': 'pure',
242
+ 'std_collections.list_concat': 'pure',
243
+ 'std_collections.map_get': 'pure',
244
+ 'std_collections.map_set': 'pure',
245
+ 'std_collections.map_delete': 'pure',
246
+ 'std_collections.map_contains_key': 'pure',
247
+ 'std_collections.map_keys': 'pure',
248
+ 'std_collections.map_values': 'pure',
249
+ 'std_collections.map_entries': 'pure',
250
+ 'std_collections.map_from_entries': 'pure',
251
+ 'std_collections.map_merge': 'pure',
252
+ 'std_collections.map_map': 'pure',
253
+ 'std_collections.map_filter': 'pure',
254
+ 'std_collections.map_is_empty': 'pure',
255
+ 'std_collections.map_length': 'pure',
256
+ 'std_collections.set_create': 'pure',
257
+ 'std_collections.set_add': 'pure',
258
+ 'std_collections.set_remove': 'pure',
259
+ 'std_collections.set_contains': 'pure',
260
+ 'std_collections.set_union': 'pure',
261
+ 'std_collections.set_intersection': 'pure',
262
+ 'std_collections.set_difference': 'pure',
263
+ 'std_collections.set_length': 'pure',
264
+ 'std_collections.set_is_empty': 'pure',
265
+ 'std_collections.set_to_list': 'pure',
266
+ 'std_collections.string_join': 'pure',
267
+ // ── std_convert (all pure) ──
268
+ 'std_convert.json_encode': 'pure',
269
+ 'std_convert.json_decode': 'pure',
270
+ 'std_convert.utf8_encode': 'pure',
271
+ 'std_convert.utf8_decode': 'pure',
272
+ 'std_convert.base64_encode': 'pure',
273
+ 'std_convert.base64_decode': 'pure',
274
+ // ── std_time ──
275
+ 'std_time.now': 'time',
276
+ 'std_time.now_micros': 'time',
277
+ 'std_time.format_timestamp': 'time',
278
+ 'std_time.parse_timestamp': 'time',
279
+ 'std_time.duration_add': 'pure',
280
+ 'std_time.duration_subtract': 'pure',
281
+ 'std_time.year': 'time',
282
+ 'std_time.month': 'time',
283
+ 'std_time.day': 'time',
284
+ 'std_time.hour': 'time',
285
+ 'std_time.minute': 'time',
286
+ 'std_time.second': 'time',
287
+ // ── std_memory (all memory/unsafe) ──
288
+ 'std_memory.memory_alloc': 'memory',
289
+ 'std_memory.memory_free': 'memory',
290
+ 'std_memory.memory_realloc': 'memory',
291
+ 'std_memory.memory_read_i8': 'memory',
292
+ 'std_memory.memory_read_u8': 'memory',
293
+ 'std_memory.memory_read_i16': 'memory',
294
+ 'std_memory.memory_read_u16': 'memory',
295
+ 'std_memory.memory_read_i32': 'memory',
296
+ 'std_memory.memory_read_u32': 'memory',
297
+ 'std_memory.memory_read_i64': 'memory',
298
+ 'std_memory.memory_read_u64': 'memory',
299
+ 'std_memory.memory_read_f32': 'memory',
300
+ 'std_memory.memory_read_f64': 'memory',
301
+ 'std_memory.memory_write_i8': 'memory',
302
+ 'std_memory.memory_write_u8': 'memory',
303
+ 'std_memory.memory_write_i16': 'memory',
304
+ 'std_memory.memory_write_u16': 'memory',
305
+ 'std_memory.memory_write_i32': 'memory',
306
+ 'std_memory.memory_write_u32': 'memory',
307
+ 'std_memory.memory_write_i64': 'memory',
308
+ 'std_memory.memory_write_u64': 'memory',
309
+ 'std_memory.memory_write_f32': 'memory',
310
+ 'std_memory.memory_write_f64': 'memory',
311
+ 'std_memory.memory_copy': 'memory',
312
+ 'std_memory.memory_set': 'memory',
313
+ 'std_memory.memory_compare': 'memory',
314
+ 'std_memory.ptr_add': 'memory',
315
+ 'std_memory.ptr_sub': 'memory',
316
+ 'std_memory.ptr_diff': 'memory',
317
+ 'std_memory.stack_alloc': 'memory',
318
+ 'std_memory.stack_push_frame': 'memory',
319
+ 'std_memory.stack_pop_frame': 'memory',
320
+ 'std_memory.memory_sizeof': 'memory',
321
+ 'std_memory.address_of': 'memory',
322
+ 'std_memory.deref': 'memory',
323
+ 'std_memory.nullptr': 'memory',
324
+ 'std_memory.memory_heap_size': 'memory',
325
+ 'std_memory.memory_stack_size': 'memory',
326
+ // ── std_concurrency ──
327
+ 'std_concurrency.thread_spawn': 'concurrency',
328
+ 'std_concurrency.thread_join': 'concurrency',
329
+ 'std_concurrency.mutex_create': 'concurrency',
330
+ 'std_concurrency.mutex_lock': 'concurrency',
331
+ 'std_concurrency.mutex_unlock': 'concurrency',
332
+ 'std_concurrency.scoped_lock': 'concurrency',
333
+ 'std_concurrency.atomic_load': 'concurrency',
334
+ 'std_concurrency.atomic_store': 'concurrency',
335
+ 'std_concurrency.atomic_compare_exchange': 'concurrency',
336
+ };
337
+ //# sourceMappingURL=capability_table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability_table.js","sourceRoot":"","sources":["../src/capability_table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,SAAS;IACT,OAAO;CACR,CAAC;AAEF,kDAAkD;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAA+B;IAC7D,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,QAAQ;IACZ,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,MAAM;IACd,WAAW,EA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AAa;IAC5C,8BAA8B,EAAE,aAAa;IAC7C,4BAA4B,EAAE,aAAa;IAC3C,8BAA8B,EAAE,aAAa;IAC7C,6BAA6B,EAAE,aAAa;IAC5C,6BAA6B,EAAE,aAAa;IAC5C,8BAA8B,EAAE,aAAa;IAC7C,yCAAyC,EAAE,aAAa;CACzD,CAAC"}
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Ball CLI — command-line interface for the Ball programming language.
4
+ *
5
+ * Commands:
6
+ * ball run <program.ball.json> Execute a Ball program.
7
+ * ball audit <program.ball.json> Static capability analysis.
8
+ * ball --version Print version.
9
+ * ball --help Print usage.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}
package/dist/index.js ADDED
@@ -0,0 +1,216 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Ball CLI — command-line interface for the Ball programming language.
4
+ *
5
+ * Commands:
6
+ * ball run <program.ball.json> Execute a Ball program.
7
+ * ball audit <program.ball.json> Static capability analysis.
8
+ * ball --version Print version.
9
+ * ball --help Print usage.
10
+ */
11
+ import { readFileSync, writeFileSync } from 'node:fs';
12
+ import { fileURLToPath } from 'node:url';
13
+ import { dirname, join } from 'node:path';
14
+ import { BallEngine } from '@ball-lang/engine';
15
+ import { analyzeCapabilities, checkPolicy, formatCapabilityReport, } from "./capability_analyzer.js";
16
+ const VERSION = readVersion();
17
+ const USAGE = `ball — the Ball language CLI (v${VERSION})
18
+
19
+ USAGE
20
+ ball <command> [options]
21
+
22
+ COMMANDS
23
+ run <program.ball.json> Execute a Ball program and print stdout.
24
+ audit <program.ball.json> Static capability analysis (I/O, fs, network, ...).
25
+
26
+ OPTIONS
27
+ -h, --help Print this help message.
28
+ -v, --version Print version information.
29
+
30
+ AUDIT OPTIONS
31
+ --output <path> Write the JSON report to <path>.
32
+ --deny <caps> Comma-separated capabilities to deny
33
+ (e.g. 'fs,network,process'). Exit 1 on violation.
34
+ --reachable-only Only analyze functions reachable from the entry.
35
+ --json Emit JSON report to stdout (instead of text).
36
+
37
+ EXAMPLES
38
+ ball run examples/hello_world/hello_world.ball.json
39
+ ball audit my_program.ball.json
40
+ ball audit my_program.ball.json --deny fs,network
41
+ ball audit my_program.ball.json --output report.json --json
42
+ `;
43
+ function parseArgs(argv) {
44
+ const flags = {};
45
+ const positional = [];
46
+ let command;
47
+ for (let i = 0; i < argv.length; i++) {
48
+ const arg = argv[i];
49
+ if (arg === '--') {
50
+ for (let j = i + 1; j < argv.length; j++)
51
+ positional.push(argv[j]);
52
+ break;
53
+ }
54
+ if (arg.startsWith('--')) {
55
+ const eq = arg.indexOf('=');
56
+ if (eq >= 0) {
57
+ const key = arg.substring(2, eq);
58
+ flags[key] = arg.substring(eq + 1);
59
+ }
60
+ else {
61
+ const key = arg.substring(2);
62
+ const next = argv[i + 1];
63
+ if (next !== undefined && !next.startsWith('-')) {
64
+ flags[key] = next;
65
+ i++;
66
+ }
67
+ else {
68
+ flags[key] = true;
69
+ }
70
+ }
71
+ continue;
72
+ }
73
+ if (arg.startsWith('-') && arg.length > 1) {
74
+ const short = arg.substring(1);
75
+ flags[short] = true;
76
+ continue;
77
+ }
78
+ if (command === undefined) {
79
+ command = arg;
80
+ }
81
+ else {
82
+ positional.push(arg);
83
+ }
84
+ }
85
+ return { command, positional, flags };
86
+ }
87
+ function readVersion() {
88
+ // package.json lives one directory up from either dist/ or src/.
89
+ try {
90
+ const here = dirname(fileURLToPath(import.meta.url));
91
+ const pkgPath = join(here, '..', 'package.json');
92
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
93
+ if (typeof pkg.version === 'string')
94
+ return pkg.version;
95
+ }
96
+ catch {
97
+ // Fallthrough.
98
+ }
99
+ return '0.0.0';
100
+ }
101
+ function loadProgram(path) {
102
+ let raw;
103
+ try {
104
+ raw = readFileSync(path, 'utf8');
105
+ }
106
+ catch (e) {
107
+ const err = e;
108
+ if (err.code === 'ENOENT') {
109
+ fail(`File not found: ${path}`);
110
+ }
111
+ fail(`Could not read ${path}: ${err.message}`);
112
+ }
113
+ try {
114
+ return JSON.parse(raw);
115
+ }
116
+ catch (e) {
117
+ const err = e;
118
+ fail(`Invalid JSON in ${path}: ${err.message}`);
119
+ }
120
+ }
121
+ function fail(message) {
122
+ process.stderr.write(`ball: ${message}\n`);
123
+ process.exit(1);
124
+ }
125
+ function cmdRun(args) {
126
+ const programPath = args.positional[0];
127
+ if (!programPath) {
128
+ process.stderr.write('ball: run requires a program path\n\n');
129
+ process.stderr.write(USAGE);
130
+ return 1;
131
+ }
132
+ const program = loadProgram(programPath);
133
+ const engine = new BallEngine(program, {
134
+ stdout: (msg) => process.stdout.write(msg + '\n'),
135
+ stderr: (msg) => process.stderr.write(msg + '\n'),
136
+ });
137
+ try {
138
+ engine.run();
139
+ }
140
+ catch (e) {
141
+ const err = e;
142
+ fail(`runtime error: ${err.message}`);
143
+ }
144
+ return 0;
145
+ }
146
+ function cmdAudit(args) {
147
+ const programPath = args.positional[0];
148
+ if (!programPath) {
149
+ process.stderr.write('ball: audit requires a program path\n\n');
150
+ process.stderr.write(USAGE);
151
+ return 1;
152
+ }
153
+ const program = loadProgram(programPath);
154
+ const reachableOnly = args.flags['reachable-only'] === true;
155
+ const report = analyzeCapabilities(program, { reachableOnly });
156
+ const denyRaw = args.flags['deny'];
157
+ const denySet = typeof denyRaw === 'string'
158
+ ? new Set(denyRaw
159
+ .split(',')
160
+ .map((c) => c.trim())
161
+ .filter((c) => c.length > 0))
162
+ : new Set();
163
+ const outputPath = args.flags['output'];
164
+ if (typeof outputPath === 'string') {
165
+ try {
166
+ writeFileSync(outputPath, JSON.stringify(report, null, 2) + '\n');
167
+ }
168
+ catch (e) {
169
+ const err = e;
170
+ fail(`could not write ${outputPath}: ${err.message}`);
171
+ }
172
+ }
173
+ const asJson = args.flags['json'] === true;
174
+ if (asJson) {
175
+ process.stdout.write(JSON.stringify(report, null, 2) + '\n');
176
+ }
177
+ else {
178
+ process.stdout.write(formatCapabilityReport(report));
179
+ }
180
+ if (denySet.size > 0) {
181
+ const violations = checkPolicy(report, denySet);
182
+ if (violations.length > 0) {
183
+ process.stderr.write('\nPolicy violations:\n');
184
+ for (const v of violations)
185
+ process.stderr.write(` - ${v}\n`);
186
+ return 1;
187
+ }
188
+ }
189
+ return 0;
190
+ }
191
+ function main(argv) {
192
+ const args = parseArgs(argv);
193
+ if (args.flags['help'] === true || args.flags['h'] === true) {
194
+ process.stdout.write(USAGE);
195
+ return 0;
196
+ }
197
+ if (args.flags['version'] === true || args.flags['v'] === true) {
198
+ process.stdout.write(`${VERSION}\n`);
199
+ return 0;
200
+ }
201
+ switch (args.command) {
202
+ case 'run':
203
+ return cmdRun(args);
204
+ case 'audit':
205
+ return cmdAudit(args);
206
+ case undefined:
207
+ process.stdout.write(USAGE);
208
+ return 0;
209
+ default:
210
+ process.stderr.write(`ball: unknown command '${args.command}'\n\n`);
211
+ process.stderr.write(USAGE);
212
+ return 1;
213
+ }
214
+ }
215
+ process.exit(main(process.argv.slice(2)));
216
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,sBAAsB,GAEvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;AAE9B,MAAM,KAAK,GAAG,kCAAkC,OAAO;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IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACrC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,QAAQ,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,KAAK,KAAK;YACR,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxB,KAAK,SAAS;YACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC;YACpE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@ball-lang/cli",
3
+ "version": "0.1.0",
4
+ "description": "Command-line interface for the Ball programming language. Runs Ball programs and performs static capability analysis.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "ball": "dist/index.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "sideEffects": false,
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "test": "node --experimental-strip-types --disable-warning=ExperimentalWarning test/cli_test.ts",
22
+ "prepublishOnly": "npm run build",
23
+ "prepack": "npm run build"
24
+ },
25
+ "keywords": [
26
+ "ball",
27
+ "cli",
28
+ "interpreter",
29
+ "polyglot",
30
+ "protobuf",
31
+ "programming-language",
32
+ "capability-analysis",
33
+ "static-analysis",
34
+ "audit"
35
+ ],
36
+ "license": "MIT",
37
+ "author": "Ball-Lang <ahmednfwela@bdaya-dev.com>",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/Ball-Lang/ball.git",
41
+ "directory": "ts/cli"
42
+ },
43
+ "homepage": "https://github.com/ball-lang/ball/tree/main/ts/cli#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/ball-lang/ball/issues"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "files": [
51
+ "dist/",
52
+ "src/",
53
+ "LICENSE",
54
+ "README.md"
55
+ ],
56
+ "engines": {
57
+ "node": ">=22.0.0"
58
+ },
59
+ "dependencies": {
60
+ "@ball-lang/engine": "^0.2.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^22.15.0",
64
+ "typescript": "^6.0.2"
65
+ }
66
+ }