dirac-lang 0.1.34 → 0.1.35
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/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ import "dotenv/config";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "dirac-lang",
|
|
19
|
-
version: "0.1.
|
|
19
|
+
version: "0.1.35",
|
|
20
20
|
description: "LLM-Augmented Declarative Execution",
|
|
21
21
|
type: "module",
|
|
22
22
|
main: "dist/index.js",
|
|
@@ -95,7 +95,7 @@ async function main() {
|
|
|
95
95
|
process.exit(0);
|
|
96
96
|
}
|
|
97
97
|
if (args[0] === "shell") {
|
|
98
|
-
const { DiracShell } = await import("./shell-
|
|
98
|
+
const { DiracShell } = await import("./shell-6ANKVL77.js");
|
|
99
99
|
const shellConfig = { debug: false };
|
|
100
100
|
for (let i = 1; i < args.length; i++) {
|
|
101
101
|
const arg = args[i];
|
|
@@ -28,6 +28,7 @@ var DiracShell = class {
|
|
|
28
28
|
rl;
|
|
29
29
|
inputBuffer = [];
|
|
30
30
|
baseIndent = null;
|
|
31
|
+
currentIndent = 0;
|
|
31
32
|
config;
|
|
32
33
|
constructor(config = {}) {
|
|
33
34
|
this.config = config;
|
|
@@ -72,6 +73,7 @@ var DiracShell = class {
|
|
|
72
73
|
if (this.inputBuffer.length > 0) {
|
|
73
74
|
this.inputBuffer = [];
|
|
74
75
|
this.baseIndent = null;
|
|
76
|
+
this.currentIndent = 0;
|
|
75
77
|
console.log("\n(Input cancelled)");
|
|
76
78
|
this.rl.setPrompt("> ");
|
|
77
79
|
this.rl.prompt();
|
|
@@ -91,19 +93,32 @@ var DiracShell = class {
|
|
|
91
93
|
this.inputBuffer.push(input);
|
|
92
94
|
this.baseIndent = indent;
|
|
93
95
|
if (this.needsContinuation(input)) {
|
|
96
|
+
this.currentIndent = (this.baseIndent || 0) + 2;
|
|
94
97
|
this.rl.setPrompt("... ");
|
|
95
|
-
console.log(
|
|
98
|
+
console.log(` (Indent with ${this.currentIndent} spaces, or press Enter on empty line to execute)`);
|
|
96
99
|
this.rl.prompt();
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
99
102
|
} else {
|
|
100
103
|
if (input.trim() === "") {
|
|
101
104
|
await this.executeBuffer();
|
|
105
|
+
this.currentIndent = 0;
|
|
102
106
|
this.rl.setPrompt("> ");
|
|
103
107
|
this.rl.prompt();
|
|
104
108
|
return;
|
|
105
109
|
}
|
|
106
|
-
|
|
110
|
+
let processedInput = input;
|
|
111
|
+
if (this.currentIndent > 0 && indent < this.currentIndent) {
|
|
112
|
+
processedInput = " ".repeat(this.currentIndent) + input;
|
|
113
|
+
}
|
|
114
|
+
this.inputBuffer.push(processedInput);
|
|
115
|
+
const trimmed = input.trim();
|
|
116
|
+
const currentLineIndent = this.getIndent(processedInput);
|
|
117
|
+
if (trimmed.match(/^<[a-zA-Z_][a-zA-Z0-9_-]*.*\|$/) || trimmed.match(/^\|[a-zA-Z_][a-zA-Z0-9_-]*\s*[^>]*?>$/) && !trimmed.match(/>\s*.+$/)) {
|
|
118
|
+
this.currentIndent = currentLineIndent + 2;
|
|
119
|
+
} else {
|
|
120
|
+
this.currentIndent = currentLineIndent;
|
|
121
|
+
}
|
|
107
122
|
this.rl.setPrompt("... ");
|
|
108
123
|
this.rl.prompt();
|
|
109
124
|
return;
|
|
@@ -174,12 +189,10 @@ Syntax:
|
|
|
174
189
|
|
|
175
190
|
Multi-line Input:
|
|
176
191
|
- Type a line that needs continuation (like <greeting| or |llm>)
|
|
177
|
-
- Shell switches to '...' prompt
|
|
178
|
-
-
|
|
192
|
+
- Shell switches to '...' prompt and shows expected indent level
|
|
193
|
+
- You can type spaces manually, or just type content (shell adds spaces)
|
|
179
194
|
- Press ENTER on an empty line to execute
|
|
180
195
|
- Or press Ctrl+C to cancel
|
|
181
|
-
|
|
182
|
-
Note: You must manually add spaces for indentation (2 spaces per level)
|
|
183
196
|
|
|
184
197
|
Examples:
|
|
185
198
|
|output>Hello World
|