@isl-lang/repl 0.0.1 → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ISL Lang
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,107 @@
1
+ # @isl-lang/repl
2
+
3
+ Interactive REPL for exploring ISL (Intent Specification Language) specifications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @isl-lang/repl
9
+
10
+ # Or use via the CLI
11
+ npm install -g @isl-lang/cli
12
+ isl repl
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```bash
18
+ # Start the REPL
19
+ isl-repl
20
+
21
+ # Or via the main CLI
22
+ isl repl
23
+ ```
24
+
25
+ ### REPL Commands
26
+
27
+ ```
28
+ ISL REPL v0.1.0
29
+ Type .help for available commands
30
+
31
+ isl> .help
32
+ .help Show this help message
33
+ .load <file> Load an ISL file
34
+ .clear Clear the current context
35
+ .types Show loaded types
36
+ .intents Show loaded intents
37
+ .domains Show loaded domains
38
+ .ast Show AST for last input
39
+ .exit Exit the REPL
40
+
41
+ isl> domain Test {
42
+ ...> type User { id: uuid, name: string }
43
+ ...> }
44
+ Domain 'Test' defined with 1 type
45
+
46
+ isl> .types
47
+ Test.User { id: uuid, name: string }
48
+
49
+ isl> .load ./specs/api.isl
50
+ Loaded: ./specs/api.isl (3 domains, 12 intents)
51
+ ```
52
+
53
+ ## Programmatic Usage
54
+
55
+ ```typescript
56
+ import { Repl, createReplContext } from '@isl-lang/repl';
57
+
58
+ // Create a REPL instance
59
+ const repl = new Repl({
60
+ prompt: 'myapp> ',
61
+ historyFile: '.myapp_history',
62
+ });
63
+
64
+ // Pre-load files
65
+ await repl.loadFile('./specs/base.isl');
66
+
67
+ // Evaluate expressions
68
+ const result = await repl.evaluate('type User { name: string }');
69
+
70
+ // Start interactive mode
71
+ repl.start();
72
+ ```
73
+
74
+ ## Features
75
+
76
+ - **Syntax highlighting** - Colorized ISL syntax
77
+ - **Auto-completion** - Tab completion for keywords and loaded symbols
78
+ - **History** - Command history with up/down arrows
79
+ - **Multi-line input** - Automatic detection of incomplete input
80
+ - **File loading** - Load and explore existing ISL files
81
+ - **AST inspection** - View the parsed AST
82
+
83
+ ## Configuration
84
+
85
+ Create `.islrc` in your home directory:
86
+
87
+ ```json
88
+ {
89
+ "historySize": 1000,
90
+ "prompt": "isl> ",
91
+ "colors": true,
92
+ "autoLoad": ["~/.isl/prelude.isl"]
93
+ }
94
+ ```
95
+
96
+ ## Documentation
97
+
98
+ Full documentation: https://isl-lang.dev/docs/repl
99
+
100
+ ## Related Packages
101
+
102
+ - [@isl-lang/cli](https://npm.im/@isl-lang/cli) - Full CLI tool
103
+ - [@isl-lang/parser](https://npm.im/@isl-lang/parser) - ISL parser
104
+
105
+ ## License
106
+
107
+ MIT