@lotics/cli 0.88.0 → 0.88.1

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.
Files changed (87) hide show
  1. package/dist/render_page.js +100 -100
  2. package/dist/src/cli.js +100 -100
  3. package/dist/{client.d.ts → src/client.d.ts} +1 -1
  4. package/dist/src/package_content_types.d.ts +70 -0
  5. package/dist/src/package_content_types.js +12 -0
  6. package/package.json +2 -2
  7. package/dist/app_commands.d.ts +0 -401
  8. package/dist/app_commands.js +0 -1520
  9. package/dist/app_commands.test.d.ts +0 -1
  10. package/dist/app_commands.test.js +0 -898
  11. package/dist/app_workflow_check.d.ts +0 -77
  12. package/dist/app_workflow_check.js +0 -169
  13. package/dist/app_workflow_check.test.d.ts +0 -1
  14. package/dist/app_workflow_check.test.js +0 -166
  15. package/dist/args.d.ts +0 -42
  16. package/dist/args.js +0 -121
  17. package/dist/args.test.d.ts +0 -1
  18. package/dist/args.test.js +0 -88
  19. package/dist/child_env.d.ts +0 -13
  20. package/dist/child_env.js +0 -24
  21. package/dist/cli.d.ts +0 -2
  22. package/dist/cli.js +0 -1095
  23. package/dist/cli_dispatch.test.d.ts +0 -1
  24. package/dist/cli_dispatch.test.js +0 -89
  25. package/dist/client.test.d.ts +0 -1
  26. package/dist/client.test.js +0 -47
  27. package/dist/config.d.ts +0 -124
  28. package/dist/config.js +0 -315
  29. package/dist/config.test.d.ts +0 -1
  30. package/dist/config.test.js +0 -319
  31. package/dist/dev/file_relay.d.ts +0 -39
  32. package/dist/dev/file_relay.js +0 -87
  33. package/dist/dev/file_relay.test.d.ts +0 -1
  34. package/dist/dev/file_relay.test.js +0 -87
  35. package/dist/dev/rpc_handler.d.ts +0 -21
  36. package/dist/dev/rpc_handler.js +0 -166
  37. package/dist/dev/rpc_handler.test.d.ts +0 -1
  38. package/dist/dev/rpc_handler.test.js +0 -107
  39. package/dist/dev/server.d.ts +0 -75
  40. package/dist/dev/server.js +0 -443
  41. package/dist/dev/upload_relay.d.ts +0 -36
  42. package/dist/dev/upload_relay.js +0 -61
  43. package/dist/dev/upload_relay.test.d.ts +0 -1
  44. package/dist/dev/upload_relay.test.js +0 -76
  45. package/dist/dev/wrapper_page.d.ts +0 -40
  46. package/dist/dev/wrapper_page.js +0 -335
  47. package/dist/docx.d.ts +0 -2
  48. package/dist/docx.js +0 -341
  49. package/dist/docx.test.d.ts +0 -1
  50. package/dist/docx.test.js +0 -145
  51. package/dist/file_command_io.d.ts +0 -12
  52. package/dist/file_command_io.js +0 -34
  53. package/dist/generate_app_agents_dts.d.ts +0 -16
  54. package/dist/generate_app_agents_dts.js +0 -62
  55. package/dist/generate_app_agents_dts.test.d.ts +0 -1
  56. package/dist/generate_app_agents_dts.test.js +0 -45
  57. package/dist/generate_app_fields.d.ts +0 -56
  58. package/dist/generate_app_fields.js +0 -148
  59. package/dist/generate_app_fields.test.d.ts +0 -1
  60. package/dist/generate_app_fields.test.js +0 -108
  61. package/dist/generate_app_queries_dts.d.ts +0 -21
  62. package/dist/generate_app_queries_dts.js +0 -57
  63. package/dist/generate_app_workflows_dts.d.ts +0 -39
  64. package/dist/generate_app_workflows_dts.js +0 -229
  65. package/dist/generate_app_workflows_dts.test.d.ts +0 -1
  66. package/dist/generate_app_workflows_dts.test.js +0 -109
  67. package/dist/generate_package_fields.d.ts +0 -49
  68. package/dist/generate_package_fields.js +0 -157
  69. package/dist/generate_package_fields.test.d.ts +0 -1
  70. package/dist/generate_package_fields.test.js +0 -59
  71. package/dist/inputs.d.ts +0 -38
  72. package/dist/inputs.js +0 -50
  73. package/dist/inputs.test.d.ts +0 -1
  74. package/dist/inputs.test.js +0 -89
  75. package/dist/preview.d.ts +0 -3
  76. package/dist/preview.js +0 -233
  77. package/dist/starter_template.d.ts +0 -64
  78. package/dist/starter_template.js +0 -753
  79. package/dist/starter_template.test.d.ts +0 -1
  80. package/dist/starter_template.test.js +0 -115
  81. package/dist/version.d.ts +0 -1
  82. package/dist/version.js +0 -6
  83. package/dist/xlsx.d.ts +0 -2
  84. package/dist/xlsx.js +0 -489
  85. package/dist/xlsx.test.d.ts +0 -1
  86. package/dist/xlsx.test.js +0 -131
  87. /package/dist/{client.js → src/client.js} +0 -0
package/dist/xlsx.test.js DELETED
@@ -1,131 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
2
- import fs from "node:fs";
3
- import path from "node:path";
4
- import os from "node:os";
5
- import { parseExcelBuffer } from "@lotics/xlsx/excel_parser";
6
- import { runXlsxCommand } from "./xlsx.js";
7
- import { CliError } from "./file_command_io.js";
8
- let tmpDir;
9
- let file;
10
- beforeEach(() => {
11
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "xlsx-test-"));
12
- file = path.join(tmpDir, "test.xlsx");
13
- // Silence the "Wrote <path>" status line that handlers emit on writes.
14
- vi.spyOn(console, "error").mockImplementation(() => { });
15
- });
16
- afterEach(() => {
17
- vi.restoreAllMocks();
18
- fs.rmSync(tmpDir, { recursive: true, force: true });
19
- });
20
- function parseFile(p) {
21
- const bytes = fs.readFileSync(p);
22
- const ab = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
23
- return parseExcelBuffer(ab);
24
- }
25
- async function writeFresh(json) {
26
- await runXlsxCommand("write", file, [json]);
27
- }
28
- describe("xlsx write + read", () => {
29
- it("round-trips cells, merges, and freeze", async () => {
30
- await writeFresh(JSON.stringify({
31
- sheets: [{
32
- name: "S1",
33
- cells: { A1: "hi", B1: 42, C1: true, D1: { formula: "A1" } },
34
- merges: ["A1:B1"],
35
- freeze: { row: 1, col: 1 },
36
- }],
37
- }));
38
- const parsed = parseFile(file);
39
- expect(parsed.sheets[0].name).toBe("S1");
40
- expect(parsed.sheets[0].rows[0].cells.map((c) => c.value)).toEqual(["hi", "42", "TRUE", ""]);
41
- expect(parsed.sheets[0].rows[0].cells[3].formula).toBe("A1");
42
- expect(parsed.sheets[0].mergedCells).toHaveLength(1);
43
- expect(parsed.sheets[0].freezePane).toEqual({ frozenRows: 1, frozenCols: 1 });
44
- });
45
- it("read dumps the file as JSON to stdout", async () => {
46
- await writeFresh(JSON.stringify({ sheets: [{ name: "S1", cells: { A1: "hi" } }] }));
47
- const stdout = vi.spyOn(console, "log").mockImplementation(() => { });
48
- await runXlsxCommand("read", file, []);
49
- const printed = JSON.parse(stdout.mock.calls[0][0]);
50
- expect(printed.sheets[0].name).toBe("S1");
51
- expect(printed.sheets[0].cells.A1.value).toBe("hi");
52
- });
53
- });
54
- describe("xlsx single-op mutations", () => {
55
- beforeEach(async () => {
56
- await writeFresh(JSON.stringify({ sheets: [{ name: "S1", cells: { A1: "hi" } }] }));
57
- });
58
- it("set-cell writes a literal", async () => {
59
- await runXlsxCommand("set-cell", file, ["S1!B2", "world"]);
60
- expect(parseFile(file).sheets[0].rows[1].cells[0].value).toBe("world");
61
- });
62
- it("set-cell writes a formula", async () => {
63
- await runXlsxCommand("set-cell", file, ["S1!B1", "=A1"]);
64
- expect(parseFile(file).sheets[0].rows[0].cells[1].formula).toBe("A1");
65
- });
66
- it("clear-range removes cells in the range", async () => {
67
- await runXlsxCommand("set-cell", file, ["S1!B1", "x"]);
68
- await runXlsxCommand("clear-range", file, ["S1!A1:B1"]);
69
- expect(parseFile(file).sheets[0].rows).toEqual([]);
70
- });
71
- it("merge + unmerge round-trip", async () => {
72
- await runXlsxCommand("merge", file, ["S1!A1:B1"]);
73
- expect(parseFile(file).sheets[0].mergedCells).toHaveLength(1);
74
- await runXlsxCommand("unmerge", file, ["S1!A1:B1"]);
75
- expect(parseFile(file).sheets[0].mergedCells).toHaveLength(0);
76
- });
77
- it("add-sheet, rename-sheet, delete-sheet", async () => {
78
- await runXlsxCommand("add-sheet", file, ["S2"]);
79
- expect(parseFile(file).sheets.map((s) => s.name)).toEqual(["S1", "S2"]);
80
- await runXlsxCommand("rename-sheet", file, ["S2", "Renamed"]);
81
- expect(parseFile(file).sheets.map((s) => s.name)).toEqual(["S1", "Renamed"]);
82
- await runXlsxCommand("delete-sheet", file, ["Renamed"]);
83
- expect(parseFile(file).sheets.map((s) => s.name)).toEqual(["S1"]);
84
- });
85
- it("insert-rows shifts existing cells", async () => {
86
- await runXlsxCommand("set-cell", file, ["S1!A2", "below"]);
87
- await runXlsxCommand("insert-rows", file, ["S1", "1", "1"]);
88
- // Original A1 ("hi") shifts to A2; original A2 ("below") shifts to A3.
89
- const rows = parseFile(file).sheets[0].rows;
90
- expect(rows.find((r) => r.index === 2)?.cells[0].value).toBe("hi");
91
- expect(rows.find((r) => r.index === 3)?.cells[0].value).toBe("below");
92
- });
93
- });
94
- describe("xlsx batch", () => {
95
- it("applies multiple ops in one parse/export cycle", async () => {
96
- await writeFresh(JSON.stringify({ sheets: [{ name: "S1", cells: { A1: "x" } }] }));
97
- const ops = [
98
- { op: "set-cell", sheet: "S1", ref: "A2", value: "y" },
99
- { op: "merge", sheet: "S1", range: "A1:B1" },
100
- { op: "add-sheet", name: "S2" },
101
- ];
102
- await runXlsxCommand("batch", file, [JSON.stringify(ops)]);
103
- const parsed = parseFile(file);
104
- expect(parsed.sheets.map((s) => s.name)).toEqual(["S1", "S2"]);
105
- expect(parsed.sheets[0].mergedCells).toHaveLength(1);
106
- expect(parsed.sheets[0].rows.find((r) => r.index === 2)?.cells[0].value).toBe("y");
107
- });
108
- });
109
- describe("xlsx error paths", () => {
110
- it("fails on unknown sheet name", async () => {
111
- await writeFresh(JSON.stringify({ sheets: [{ name: "S1" }] }));
112
- await expect(runXlsxCommand("set-cell", file, ["Nope!A1", "x"])).rejects.toBeInstanceOf(CliError);
113
- });
114
- it("fails on invalid cell ref", async () => {
115
- await writeFresh(JSON.stringify({ sheets: [{ name: "S1" }] }));
116
- await expect(runXlsxCommand("set-cell", file, ["S1!ZZZ", "x"])).rejects.toBeInstanceOf(CliError);
117
- });
118
- it("fails on missing file", async () => {
119
- await expect(runXlsxCommand("set-cell", path.join(tmpDir, "no.xlsx"), ["S1!A1", "x"])).rejects.toBeInstanceOf(CliError);
120
- });
121
- it("fails on invalid write JSON", async () => {
122
- await expect(runXlsxCommand("write", file, ["{not json"])).rejects.toBeInstanceOf(CliError);
123
- });
124
- it("rejects write with non-object cells", async () => {
125
- await expect(runXlsxCommand("write", file, [JSON.stringify({ sheets: [{ name: "S", cells: "bad" }] })])).rejects.toBeInstanceOf(CliError);
126
- });
127
- it("rejects batch op without an 'op' string", async () => {
128
- await writeFresh(JSON.stringify({ sheets: [{ name: "S1" }] }));
129
- await expect(runXlsxCommand("batch", file, [JSON.stringify([{ sheet: "S1" }])])).rejects.toBeInstanceOf(CliError);
130
- });
131
- });
File without changes