dirac-lang 0.1.51 → 0.1.52

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-D2TEBI65.js";
3
+ } from "./chunk-RTIIVKY5.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
@@ -215,6 +215,7 @@ import * as fs from "fs";
215
215
  import * as path from "path";
216
216
  async function executeOutput(session, element) {
217
217
  const fileAttr = element.attributes?.file;
218
+ const modeAttr = element.attributes?.mode;
218
219
  const filePath = fileAttr ? substituteAttribute(session, fileAttr) : null;
219
220
  if (filePath) {
220
221
  let content = "";
@@ -231,7 +232,18 @@ async function executeOutput(session, element) {
231
232
  if (dir !== "." && !fs.existsSync(dir)) {
232
233
  fs.mkdirSync(dir, { recursive: true });
233
234
  }
234
- fs.appendFileSync(filePath, content + "\n", "utf8");
235
+ const mode = modeAttr || "append";
236
+ if (mode === "overwrite") {
237
+ fs.writeFileSync(filePath, content + "\n", "utf8");
238
+ if (session.debug) {
239
+ console.error(`[OUTPUT] Wrote (overwrite) to ${filePath}: ${content.substring(0, 50)}...`);
240
+ }
241
+ } else {
242
+ fs.appendFileSync(filePath, content + "\n", "utf8");
243
+ if (session.debug) {
244
+ console.error(`[OUTPUT] Appended to ${filePath}: ${content.substring(0, 50)}...`);
245
+ }
246
+ }
235
247
  return;
236
248
  }
237
249
  if (element.children && element.children.length > 0) {
@@ -460,12 +472,12 @@ async function executeIf(session, element) {
460
472
  const condition = await evaluatePredicate(session, conditionElement);
461
473
  if (condition) {
462
474
  if (thenElement) {
463
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
475
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
464
476
  await integrateChildren2(session, thenElement);
465
477
  }
466
478
  } else {
467
479
  if (elseElement) {
468
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
480
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
469
481
  await integrateChildren2(session, elseElement);
470
482
  }
471
483
  }
@@ -478,7 +490,7 @@ async function evaluatePredicate(session, predicateElement) {
478
490
  return await evaluateCondition(session, predicateElement);
479
491
  }
480
492
  const outputLengthBefore = session.output.length;
481
- const { integrate: integrate2 } = await import("./interpreter-BDXB5X77.js");
493
+ const { integrate: integrate2 } = await import("./interpreter-3UK7U2HN.js");
482
494
  await integrate2(session, predicateElement);
483
495
  const newOutputChunks = session.output.slice(outputLengthBefore);
484
496
  const result = newOutputChunks.join("").trim();
@@ -501,11 +513,11 @@ async function evaluateCondition(session, condElement) {
501
513
  }
502
514
  const outputLengthBefore = session.output.length;
503
515
  const args = [];
504
- const { integrate: integrate2 } = await import("./interpreter-BDXB5X77.js");
516
+ const { integrate: integrate2 } = await import("./interpreter-3UK7U2HN.js");
505
517
  for (const child of condElement.children) {
506
518
  if (child.tag.toLowerCase() === "arg") {
507
519
  const argOutputStart = session.output.length;
508
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
520
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
509
521
  await integrateChildren2(session, child);
510
522
  const newChunks = session.output.slice(argOutputStart);
511
523
  const argValue = newChunks.join("");
@@ -1601,7 +1613,7 @@ async function executeTagCheck(session, element) {
1601
1613
  const executeTag = correctedTag || tagName;
1602
1614
  console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
1603
1615
  const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
1604
- const { integrate: integrate2 } = await import("./interpreter-BDXB5X77.js");
1616
+ const { integrate: integrate2 } = await import("./interpreter-3UK7U2HN.js");
1605
1617
  await integrate2(session, elementToExecute);
1606
1618
  }
1607
1619
  }
@@ -1610,7 +1622,7 @@ async function executeTagCheck(session, element) {
1610
1622
  // src/tags/throw.ts
1611
1623
  async function executeThrow(session, element) {
1612
1624
  const exceptionName = element.attributes?.name || "exception";
1613
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
1625
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
1614
1626
  const exceptionDom = {
1615
1627
  tag: "exception-content",
1616
1628
  attributes: { name: exceptionName },
@@ -1623,7 +1635,7 @@ async function executeThrow(session, element) {
1623
1635
  // src/tags/try.ts
1624
1636
  async function executeTry(session, element) {
1625
1637
  setExceptionBoundary(session);
1626
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
1638
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
1627
1639
  await integrateChildren2(session, element);
1628
1640
  unsetExceptionBoundary(session);
1629
1641
  }
@@ -1633,7 +1645,7 @@ async function executeCatch(session, element) {
1633
1645
  const exceptionName = element.attributes?.name || "exception";
1634
1646
  const caughtCount = lookupException(session, exceptionName);
1635
1647
  if (caughtCount > 0) {
1636
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
1648
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
1637
1649
  await integrateChildren2(session, element);
1638
1650
  }
1639
1651
  flushCurrentException(session);
@@ -1642,7 +1654,7 @@ async function executeCatch(session, element) {
1642
1654
  // src/tags/exception.ts
1643
1655
  async function executeException(session, element) {
1644
1656
  const exceptions = getCurrentExceptions(session);
1645
- const { integrateChildren: integrateChildren2 } = await import("./interpreter-BDXB5X77.js");
1657
+ const { integrateChildren: integrateChildren2 } = await import("./interpreter-3UK7U2HN.js");
1646
1658
  for (const exceptionDom of exceptions) {
1647
1659
  await integrateChildren2(session, exceptionDom);
1648
1660
  }
@@ -2109,7 +2121,7 @@ async function executeLoadContext(session, element) {
2109
2121
  query = element.text.trim();
2110
2122
  }
2111
2123
  if (!query && element.children.length > 0) {
2112
- const { integrate: integrate2 } = await import("./interpreter-BDXB5X77.js");
2124
+ const { integrate: integrate2 } = await import("./interpreter-3UK7U2HN.js");
2113
2125
  const beforeOutput = session.output.length;
2114
2126
  for (const child of element.children) {
2115
2127
  await integrate2(session, child);
@@ -2184,7 +2196,7 @@ async function executeLoadContext(session, element) {
2184
2196
  }
2185
2197
 
2186
2198
  // src/tags/save-subroutine.ts
2187
- import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4, existsSync as existsSync5 } from "fs";
2199
+ import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, existsSync as existsSync5 } from "fs";
2188
2200
  import { resolve as resolve2, dirname as dirname4, join as join4 } from "path";
2189
2201
  import { homedir as homedir4 } from "os";
2190
2202
  async function executeSaveSubroutine(session, element) {
@@ -2226,7 +2238,7 @@ async function executeSaveSubroutine(session, element) {
2226
2238
  if (!existsSync5(dir)) {
2227
2239
  mkdirSync4(dir, { recursive: true });
2228
2240
  }
2229
- writeFileSync3(filePath, content, "utf-8");
2241
+ writeFileSync4(filePath, content, "utf-8");
2230
2242
  emit(session, `Subroutine '${name}' saved to: ${filePath}
2231
2243
  `);
2232
2244
  if (session.debug) {
@@ -2362,7 +2374,7 @@ async function executeForeach(session, element) {
2362
2374
  const parser2 = new DiracParser2();
2363
2375
  try {
2364
2376
  const fromElement = parser2.parse(fromAttr);
2365
- const { integrate: integrate2 } = await import("./interpreter-BDXB5X77.js");
2377
+ const { integrate: integrate2 } = await import("./interpreter-3UK7U2HN.js");
2366
2378
  await integrate2(session, fromElement);
2367
2379
  } catch (e) {
2368
2380
  session.output = savedOutput;
package/dist/cli.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  execute
7
- } from "./chunk-BSEXAELC.js";
8
- import "./chunk-D2TEBI65.js";
7
+ } from "./chunk-7YGLAG6M.js";
8
+ import "./chunk-RTIIVKY5.js";
9
9
  import "./chunk-HRHAMPOB.js";
10
10
  import "./chunk-ZY37RS4P.js";
11
11
  import "./chunk-A4SFB5W4.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.51",
19
+ version: "0.1.52",
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-QS4PSAF6.js");
99
+ const { DiracShell } = await import("./shell-MJDYFPAB.js");
100
100
  const shellConfig = { debug: false };
101
101
  for (let i = 1; i < args.length; i++) {
102
102
  const arg = args[i];
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createLLMAdapter,
3
3
  execute,
4
4
  executeUserCommand
5
- } from "./chunk-BSEXAELC.js";
5
+ } from "./chunk-7YGLAG6M.js";
6
6
  import {
7
7
  integrate
8
- } from "./chunk-D2TEBI65.js";
8
+ } from "./chunk-RTIIVKY5.js";
9
9
  import {
10
10
  DiracParser
11
11
  } from "./chunk-HRHAMPOB.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  integrate,
3
3
  integrateChildren
4
- } from "./chunk-D2TEBI65.js";
4
+ } from "./chunk-RTIIVKY5.js";
5
5
  import "./chunk-HRHAMPOB.js";
6
6
  import "./chunk-ZY37RS4P.js";
7
7
  import "./chunk-A4SFB5W4.js";
@@ -3,7 +3,7 @@ import {
3
3
  listScheduledTasks,
4
4
  stopAllScheduledTasks,
5
5
  stopScheduledTask
6
- } from "./chunk-D2TEBI65.js";
6
+ } from "./chunk-RTIIVKY5.js";
7
7
  import "./chunk-HRHAMPOB.js";
8
8
  import "./chunk-ZY37RS4P.js";
9
9
  import "./chunk-A4SFB5W4.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-UEFKQRYN.js";
5
5
  import {
6
6
  integrate
7
- } from "./chunk-D2TEBI65.js";
7
+ } from "./chunk-RTIIVKY5.js";
8
8
  import {
9
9
  DiracParser
10
10
  } from "./chunk-HRHAMPOB.js";
@@ -131,7 +131,7 @@ var DiracShell = class {
131
131
  });
132
132
  this.rl.on("close", () => {
133
133
  this.saveHistory();
134
- import("./schedule-WF4BAWHX.js").then(({ stopAllScheduledTasks }) => {
134
+ import("./schedule-5GCBLXBP.js").then(({ stopAllScheduledTasks }) => {
135
135
  stopAllScheduledTasks();
136
136
  console.log("\nGoodbye!");
137
137
  process.exit(0);
@@ -452,7 +452,7 @@ Examples:
452
452
  break;
453
453
  case "tasks":
454
454
  try {
455
- const { listScheduledTasks } = await import("./schedule-WF4BAWHX.js");
455
+ const { listScheduledTasks } = await import("./schedule-5GCBLXBP.js");
456
456
  const tasks = listScheduledTasks();
457
457
  if (tasks.length === 0) {
458
458
  console.log("No scheduled tasks running.");
@@ -471,7 +471,7 @@ Examples:
471
471
  console.log("Usage: :stop <task-name>");
472
472
  } else {
473
473
  try {
474
- const { stopScheduledTask } = await import("./schedule-WF4BAWHX.js");
474
+ const { stopScheduledTask } = await import("./schedule-5GCBLXBP.js");
475
475
  const taskName = args[0];
476
476
  const stopped = stopScheduledTask(taskName);
477
477
  if (stopped) {
@@ -486,7 +486,7 @@ Examples:
486
486
  break;
487
487
  case "stopall":
488
488
  try {
489
- const { stopAllScheduledTasks } = await import("./schedule-WF4BAWHX.js");
489
+ const { stopAllScheduledTasks } = await import("./schedule-5GCBLXBP.js");
490
490
  stopAllScheduledTasks();
491
491
  console.log("All scheduled tasks stopped.");
492
492
  } catch (error) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  integrate
3
- } from "./chunk-D2TEBI65.js";
3
+ } from "./chunk-RTIIVKY5.js";
4
4
  import {
5
5
  DiracParser
6
6
  } from "./chunk-HRHAMPOB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirac-lang",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "description": "LLM-Augmented Declarative Execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",