@lotics/cli 0.60.1 → 0.62.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.
@@ -108,7 +108,9 @@ export function buildStarterTemplate(args) {
108
108
  "@vitejs/plugin-react": "^4.3.0",
109
109
  jsdom: "^25.0.0",
110
110
  oxlint: "^0.13.0",
111
- typescript: "^5.6.0",
111
+ // Track the platform's TS major so `lotics app workflow check` (which runs
112
+ // the app's OWN typescript) gives the same verdict the server does at set-time.
113
+ typescript: "~6.0.3",
112
114
  vite: "^5.4.0",
113
115
  vitest: "^2.1.0",
114
116
  },
@@ -148,41 +150,17 @@ export function buildStarterTemplate(args) {
148
150
  // base, which IS read. (GAP-38.)
149
151
  include: ["src", ".lotics/**/*"],
150
152
  // src/workflows/<alias>.ts bodies run on the server (workflow globals:
151
- // trigger / runtime / tool calls). They ARE locally typecheckable
152
- // each is wrapped in the server's `__workflow` envelope and references
153
- // its per-alias `.lotics/workflows/<alias>.globals.d.ts` but under a
154
- // DEDICATED config that mirrors the server's compile options (es2022
155
- // lib, NO DOM). The main `npm run typecheck` excludes them so it stays
156
- // green and DOM-lib-free for bodies; check a body with
157
- // `tsc -p tsconfig.workflows.json`. The server is the single verifier
158
- // on `lotics app workflow set`.
159
- exclude: ["node_modules", "src/workflows"],
160
- }, null, 2) + "\n",
161
- },
162
- {
163
- // Dedicated config for the editable workflow bodies (GAP-59). Mirrors the
164
- // SERVER's set-time typecheck options (strict, lib es2022 with NO DOM,
165
- // target ES2022, skipLibCheck) so a local `tsc -p tsconfig.workflows.json`
166
- // gives the same verdict the server would on `lotics app workflow set`.
167
- // Each body file is a module (the CLI writes a bookkeeping `export {};`),
168
- // so the per-file `__workflow` wrapper doesn't collide across bodies.
169
- path: "tsconfig.workflows.json",
170
- content: JSON.stringify({
171
- compilerOptions: {
172
- target: "ES2022",
173
- lib: ["ES2022"],
174
- module: "ESNext",
175
- moduleResolution: "Bundler",
176
- strict: true,
177
- skipLibCheck: true,
178
- noEmit: true,
179
- types: [],
180
- },
181
- // The bodies + their per-alias ambient globals. `.lotics/workflows`
182
- // uses the explicit `**/*` glob for the same dot-dir walk reason the
183
- // main config does (TS's include walk skips bare dot-dirs).
184
- include: ["src/workflows", ".lotics/workflows/**/*"],
185
- exclude: ["node_modules"],
153
+ // trigger / runtime / tool calls), and each pulls its own per-alias
154
+ // ambient globals under `.lotics/workflows/`. BOTH are excluded from
155
+ // the main typecheck: the bodies would apply the app's DOM lib (the
156
+ // server doesn't), and the per-alias `.globals.d.ts` files each declare
157
+ // their OWN ambient `trigger` loading several into one program
158
+ // collides those declarations and reports false errors. Type-check the
159
+ // bodies with `lotics app workflow check` instead it builds ONE
160
+ // isolated program per alias (mirroring the server's set-time verify),
161
+ // so the ambient `trigger` is unambiguous. The server stays the single
162
+ // verifier on `lotics app workflow set`.
163
+ exclude: ["node_modules", "src/workflows", ".lotics/workflows"],
186
164
  }, null, 2) + "\n",
187
165
  },
188
166
  {
@@ -540,6 +518,7 @@ Editable JS-subset bodies of this app's workflows live here, one file per alias:
540
518
  \`\`\`bash
541
519
  lotics app workflow pull # write/refresh every src/workflows/<alias>.ts from the server
542
520
  # edit src/workflows/<alias>.ts
521
+ lotics app workflow check <alias> # typecheck the body locally (same verdict as \`set\`)
543
522
  lotics app workflow set <alias> # push it back through set_app_workflow (the server verifies)
544
523
  \`\`\`
545
524
 
@@ -551,15 +530,17 @@ A workflow body is a **JS-subset expression** that runs server-side using workfl
551
530
  globals (\`trigger\`, \`runtime\`, tool calls) and ends with \`return({ data })\`. Each
552
531
  pulled file wraps the body in the server's \`__workflow\` envelope and references its
553
532
  per-alias ambient globals at \`.lotics/workflows/<alias>.globals.d.ts\`, so it **is**
554
- locally typecheckable — under the dedicated config that mirrors the server's compile
555
- options:
533
+ locally typecheckable:
556
534
 
557
535
  \`\`\`bash
558
- tsc -p tsconfig.workflows.json # same verdict the server gives on \`set\`
536
+ lotics app workflow check # check every body; [alias] to check one
559
537
  \`\`\`
560
538
 
561
- The main \`npm run typecheck\` excludes \`src/workflows\` (it would apply the app's
562
- DOM lib, which the server doesn't), so the bodies have their own config. The
539
+ \`check\` builds ONE isolated program per alias (the app's own \`typescript\`, the
540
+ server's compile options — strict, lib es2022 with no DOM), so each body's ambient
541
+ \`trigger\` is unambiguous and the verdict mirrors set-time verify. The main
542
+ \`npm run typecheck\` excludes \`src/workflows\` + \`.lotics/workflows\` (the bodies would
543
+ apply the app's DOM lib, and the per-alias globals collide on \`trigger\`). The
563
544
  verification that matters still runs on the **server** when you \`set\` — the same
564
545
  guarantee as authoring via \`set_app_workflow\` directly. Edit only the body BETWEEN
565
546
  the wrapper lines; the wrapper, the \`/// <reference>\`, and the \`export {};\` marker
@@ -599,6 +580,9 @@ declare module "lucide-react-native/dist/esm/icons/*" {
599
580
  const classes: { [key: string]: string };
600
581
  export default classes;
601
582
  }
583
+
584
+ // Plain side-effect CSS imports (@lotics/ui ships .tsx with import "./x.css").
585
+ declare module "*.css";
602
586
  `,
603
587
  },
604
588
  {
@@ -97,15 +97,19 @@ describe("buildStarterTemplate", () => {
97
97
  const config = fileNamed(buildStarterTemplate(baseArgs), "vite.config.ts");
98
98
  expect(config).toMatch(/include:\s*\[[\s\S]*"react-router-dom"/);
99
99
  });
100
- test("ships a dedicated tsconfig.workflows.json mirroring the server's compile options (GAP-59)", () => {
101
- const cfg = JSON.parse(fileNamed(buildStarterTemplate(baseArgs), "tsconfig.workflows.json"));
102
- // Server-mirroring: es2022 lib with NO DOM, strict, skipLibCheck, target ES2022.
103
- expect(cfg.compilerOptions.lib).toEqual(["ES2022"]);
104
- expect(cfg.compilerOptions.strict).toBe(true);
105
- expect(cfg.compilerOptions.skipLibCheck).toBe(true);
106
- expect(cfg.compilerOptions.target).toBe("ES2022");
107
- // It includes the bodies + their per-alias ambient globals.
108
- expect(cfg.include).toContain("src/workflows");
109
- expect(cfg.include).toContain(".lotics/workflows/**/*");
100
+ test("main tsconfig excludes BOTH the workflow bodies and their per-alias globals (GAP-59 fix)", () => {
101
+ // npm run typecheck must skip src/workflows (DOM-lib skew) AND .lotics/workflows
102
+ // (the per-alias ambient `trigger` declarations collide across aliases and
103
+ // report false errors). Bodies are checked by `lotics app workflow check`.
104
+ const cfg = JSON.parse(fileNamed(buildStarterTemplate(baseArgs), "tsconfig.json"));
105
+ expect(cfg.exclude).toContain("src/workflows");
106
+ expect(cfg.exclude).toContain(".lotics/workflows");
107
+ });
108
+ test("no longer ships the all-in-one tsconfig.workflows.json (it collided per-alias globals)", () => {
109
+ // The dedicated config compiled every alias's globals into ONE program, so the
110
+ // ambient `trigger` declarations collided. `lotics app workflow check` replaces
111
+ // it with one isolated program per alias.
112
+ const files = buildStarterTemplate(baseArgs);
113
+ expect(files.find((f) => f.path === "tsconfig.workflows.json")).toBeUndefined();
110
114
  });
111
115
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.60.1",
3
+ "version": "0.62.1",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,6 +25,7 @@
25
25
  "@lotics/xlsx": "*",
26
26
  "@types/node": "^22.15.21",
27
27
  "esbuild": "^0.28.1",
28
+ "typescript": "^6.0.3",
28
29
  "vitest": "^4.1.7"
29
30
  },
30
31
  "keywords": [