dirac-lang 0.1.53 → 0.1.55
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.
|
@@ -73,15 +73,19 @@ var BraKetParser = class {
|
|
|
73
73
|
if (!content.trim()) {
|
|
74
74
|
return { indent, type: "empty", raw };
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
if (content.startsWith("<") && content.endsWith("|")) {
|
|
77
|
+
const tagMatch = content.match(/^<([a-zA-Z_][a-zA-Z0-9_-]*)\s*/);
|
|
78
|
+
if (tagMatch) {
|
|
79
|
+
const tagName = tagMatch[1];
|
|
80
|
+
const afterTag = content.substring(tagMatch[0].length, content.length - 1);
|
|
81
|
+
return {
|
|
82
|
+
indent,
|
|
83
|
+
type: "bra",
|
|
84
|
+
tag: tagName,
|
|
85
|
+
attrs: afterTag.trim() || void 0,
|
|
86
|
+
raw
|
|
87
|
+
};
|
|
88
|
+
}
|
|
85
89
|
}
|
|
86
90
|
const ketMatch = content.match(/^\|([a-zA-Z_][a-zA-Z0-9_-]*)\s*([^>]*?)>\s*(.*)/);
|
|
87
91
|
if (ketMatch) {
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BraKetParser
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-C6DBZRQZ.js";
|
|
5
5
|
import {
|
|
6
6
|
execute
|
|
7
7
|
} from "./chunk-EXP3R5ZJ.js";
|
|
@@ -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.55",
|
|
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-WXBGAGAP.js");
|
|
100
100
|
const shellConfig = { debug: false };
|
|
101
101
|
for (let i = 1; i < args.length; i++) {
|
|
102
102
|
const arg = args[i];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BraKetParser
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-C6DBZRQZ.js";
|
|
5
5
|
import {
|
|
6
6
|
integrate
|
|
7
7
|
} from "./chunk-QZGTAT3E.js";
|
|
@@ -52,11 +52,23 @@ var DiracShell = class {
|
|
|
52
52
|
const attrPartial = attrMatch[2];
|
|
53
53
|
const subroutine = this.session.subroutines.find((sub) => sub.name === tagName);
|
|
54
54
|
if (subroutine && subroutine.parameters && subroutine.parameters.length > 0) {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
(name) => name.toLowerCase().startsWith(attrPartial.toLowerCase())
|
|
55
|
+
const matches = subroutine.parameters.filter(
|
|
56
|
+
(p) => p.name.toLowerCase().startsWith(attrPartial.toLowerCase())
|
|
58
57
|
);
|
|
59
|
-
|
|
58
|
+
if (matches.length > 1) {
|
|
59
|
+
console.log("\n");
|
|
60
|
+
matches.forEach((p) => {
|
|
61
|
+
const parts = [];
|
|
62
|
+
if (p.type) parts.push(p.type);
|
|
63
|
+
if (p.required) parts.push("required");
|
|
64
|
+
if (p.description) parts.push(p.description);
|
|
65
|
+
if (p.options && p.options.length > 0) parts.push(`[${p.options.join(",")}]`);
|
|
66
|
+
if (p.examples && p.examples.length > 0) parts.push(`eg:${p.examples[0]}`);
|
|
67
|
+
const info = parts.length > 0 ? ` (${parts.join(" | ")})` : "";
|
|
68
|
+
console.log(` ${p.name}=${info}`);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const completions = matches.map((p) => `${p.name}=`);
|
|
60
72
|
return [completions, attrPartial];
|
|
61
73
|
}
|
|
62
74
|
}
|
|
@@ -65,11 +77,18 @@ var DiracShell = class {
|
|
|
65
77
|
const tagName = tagCompleteMatch[1];
|
|
66
78
|
const subroutine = this.session.subroutines.find((sub) => sub.name === tagName);
|
|
67
79
|
if (subroutine && subroutine.parameters && subroutine.parameters.length > 0) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
80
|
+
console.log("\n");
|
|
81
|
+
subroutine.parameters.forEach((p) => {
|
|
82
|
+
const parts = [];
|
|
83
|
+
if (p.type) parts.push(p.type);
|
|
84
|
+
if (p.required) parts.push("required");
|
|
85
|
+
if (p.description) parts.push(p.description);
|
|
86
|
+
if (p.options && p.options.length > 0) parts.push(`[${p.options.join(",")}]`);
|
|
87
|
+
if (p.examples && p.examples.length > 0) parts.push(`eg:${p.examples[0]}`);
|
|
88
|
+
const info = parts.length > 0 ? ` (${parts.join(" | ")})` : "";
|
|
89
|
+
console.log(` ${p.name}=${info}`);
|
|
72
90
|
});
|
|
91
|
+
const paramSuggestions = subroutine.parameters.map((p) => `${p.name}=`);
|
|
73
92
|
return [paramSuggestions, ""];
|
|
74
93
|
}
|
|
75
94
|
const subroutineNames = this.session.subroutines.map((sub) => sub.name);
|