dirac-lang 0.1.46 → 0.1.47
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.47",
|
|
20
20
|
description: "LLM-Augmented Declarative Execution",
|
|
21
21
|
type: "module",
|
|
22
22
|
main: "dist/index.js",
|
|
@@ -96,7 +96,7 @@ async function main() {
|
|
|
96
96
|
process.exit(0);
|
|
97
97
|
}
|
|
98
98
|
if (args[0] === "shell") {
|
|
99
|
-
const { DiracShell } = await import("./shell-
|
|
99
|
+
const { DiracShell } = await import("./shell-TNQMOYFR.js");
|
|
100
100
|
const shellConfig = { debug: false };
|
|
101
101
|
for (let i = 1; i < args.length; i++) {
|
|
102
102
|
const arg = args[i];
|
|
@@ -39,11 +39,33 @@ var DiracShell = class {
|
|
|
39
39
|
input: process.stdin,
|
|
40
40
|
output: process.stdout,
|
|
41
41
|
prompt: "> ",
|
|
42
|
-
historySize: MAX_HISTORY
|
|
42
|
+
historySize: MAX_HISTORY,
|
|
43
|
+
completer: this.completer.bind(this)
|
|
43
44
|
});
|
|
44
45
|
this.loadHistory();
|
|
45
46
|
this.setupHandlers();
|
|
46
47
|
}
|
|
48
|
+
completer(line) {
|
|
49
|
+
const braketMatch = line.match(/\|([a-z0-9_-]*)$/i);
|
|
50
|
+
if (braketMatch) {
|
|
51
|
+
const partial = braketMatch[1];
|
|
52
|
+
const subroutineNames = this.session.subroutines.map((sub) => sub.name);
|
|
53
|
+
const matches = subroutineNames.filter(
|
|
54
|
+
(name) => name.toLowerCase().startsWith(partial.toLowerCase())
|
|
55
|
+
);
|
|
56
|
+
const completions = matches.map((name) => `|${name}>`);
|
|
57
|
+
return [completions, braketMatch[0]];
|
|
58
|
+
}
|
|
59
|
+
const commandMatch = line.match(/:([a-z]*)$/i);
|
|
60
|
+
if (commandMatch) {
|
|
61
|
+
const partial = commandMatch[1];
|
|
62
|
+
const commands = ["help", "quit", "exit", "vars", "subs", "clear", "history", "save", "debug", "llm"];
|
|
63
|
+
const matches = commands.filter((cmd) => cmd.startsWith(partial.toLowerCase()));
|
|
64
|
+
const completions = matches.map((cmd) => `:${cmd}`);
|
|
65
|
+
return [completions, commandMatch[0]];
|
|
66
|
+
}
|
|
67
|
+
return [[], line];
|
|
68
|
+
}
|
|
47
69
|
loadHistory() {
|
|
48
70
|
try {
|
|
49
71
|
if (fs.existsSync(HISTORY_FILE)) {
|