dirac-lang 0.1.47 → 0.1.48
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.48",
|
|
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-P52SBQWW.js");
|
|
100
100
|
const shellConfig = { debug: false };
|
|
101
101
|
for (let i = 1; i < args.length; i++) {
|
|
102
102
|
const arg = args[i];
|
|
@@ -46,6 +46,45 @@ var DiracShell = class {
|
|
|
46
46
|
this.setupHandlers();
|
|
47
47
|
}
|
|
48
48
|
completer(line) {
|
|
49
|
+
const attrMatch = line.match(/\|([a-z0-9_-]+)\s+.*?([a-z0-9_-]*)$/i);
|
|
50
|
+
if (attrMatch) {
|
|
51
|
+
const tagName = attrMatch[1];
|
|
52
|
+
const attrPartial = attrMatch[2];
|
|
53
|
+
const subroutine = this.session.subroutines.find((sub) => sub.name === tagName);
|
|
54
|
+
if (subroutine && subroutine.parameters && subroutine.parameters.length > 0) {
|
|
55
|
+
const paramNames = subroutine.parameters.map((p) => p.name);
|
|
56
|
+
const matches = paramNames.filter(
|
|
57
|
+
(name) => name.toLowerCase().startsWith(attrPartial.toLowerCase())
|
|
58
|
+
);
|
|
59
|
+
const completions = matches.map((name) => `${name}=`);
|
|
60
|
+
return [completions, attrPartial];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const tagCompleteMatch = line.match(/\|([a-z0-9_-]+)$/i);
|
|
64
|
+
if (tagCompleteMatch) {
|
|
65
|
+
const tagName = tagCompleteMatch[1];
|
|
66
|
+
const subroutine = this.session.subroutines.find((sub) => sub.name === tagName);
|
|
67
|
+
if (subroutine && subroutine.parameters && subroutine.parameters.length > 0) {
|
|
68
|
+
const paramSuggestions = subroutine.parameters.map((p) => {
|
|
69
|
+
const required = p.required ? "*" : "";
|
|
70
|
+
const typeInfo = p.type || "string";
|
|
71
|
+
return `${p.name}=${required}${typeInfo}`;
|
|
72
|
+
});
|
|
73
|
+
return [paramSuggestions, ""];
|
|
74
|
+
}
|
|
75
|
+
const subroutineNames = this.session.subroutines.map((sub) => sub.name);
|
|
76
|
+
const matches = subroutineNames.filter(
|
|
77
|
+
(name) => name.toLowerCase().startsWith(tagName.toLowerCase())
|
|
78
|
+
);
|
|
79
|
+
if (matches.length > 0) {
|
|
80
|
+
const completions = matches.map((name) => {
|
|
81
|
+
const sub = this.session.subroutines.find((s) => s.name === name);
|
|
82
|
+
const hasParams = sub && sub.parameters && sub.parameters.length > 0;
|
|
83
|
+
return hasParams ? `|${name} ` : `|${name}>`;
|
|
84
|
+
});
|
|
85
|
+
return [completions, tagCompleteMatch[0]];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
49
88
|
const braketMatch = line.match(/\|([a-z0-9_-]*)$/i);
|
|
50
89
|
if (braketMatch) {
|
|
51
90
|
const partial = braketMatch[1];
|
|
@@ -53,7 +92,11 @@ var DiracShell = class {
|
|
|
53
92
|
const matches = subroutineNames.filter(
|
|
54
93
|
(name) => name.toLowerCase().startsWith(partial.toLowerCase())
|
|
55
94
|
);
|
|
56
|
-
const completions = matches.map((name) =>
|
|
95
|
+
const completions = matches.map((name) => {
|
|
96
|
+
const subroutine = this.session.subroutines.find((sub) => sub.name === name);
|
|
97
|
+
const hasParams = subroutine && subroutine.parameters && subroutine.parameters.length > 0;
|
|
98
|
+
return hasParams ? `|${name} ` : `|${name}>`;
|
|
99
|
+
});
|
|
57
100
|
return [completions, braketMatch[0]];
|
|
58
101
|
}
|
|
59
102
|
const commandMatch = line.match(/:([a-z]*)$/i);
|