@lotics/cli 0.57.0 → 0.60.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.
@@ -147,6 +147,41 @@ export function buildStarterTemplate(args) {
147
147
  // fall to `unknown`. The explicit glob makes the dot-dir the non-wildcard
148
148
  // base, which IS read. (GAP-38.)
149
149
  include: ["src", ".lotics/**/*"],
150
+ // 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/**/*"],
150
185
  exclude: ["node_modules"],
151
186
  }, null, 2) + "\n",
152
187
  },
@@ -483,6 +518,60 @@ const routes = [
483
518
  export default function App() {
484
519
  return <AppRouter routes={routes} />;
485
520
  }
521
+ `,
522
+ },
523
+ {
524
+ // The home for editable workflow bodies. `lotics app pull` writes one
525
+ // `src/workflows/<alias>.ts` per bound workflow (faithful server source);
526
+ // edit it, then `lotics app workflow set <alias>` pushes it back through
527
+ // set_app_workflow (the server verifies). A new app has no bound workflows
528
+ // yet, so this is just the docked directory + the loop reference. It's a
529
+ // .md (not a .ts) so tsc's `include: ["src"]` never tries to compile it —
530
+ // a workflow body is a JS-subset expression over server globals
531
+ // (trigger / runtime / tool calls) that does NOT typecheck standalone.
532
+ path: "src/workflows/README.md",
533
+ content: `# Workflow bodies
534
+
535
+ Editable JS-subset bodies of this app's workflows live here, one file per alias:
536
+ \`src/workflows/<alias>.ts\`.
537
+
538
+ ## Loop
539
+
540
+ \`\`\`bash
541
+ lotics app workflow pull # write/refresh every src/workflows/<alias>.ts from the server
542
+ # edit src/workflows/<alias>.ts
543
+ lotics app workflow set <alias> # push it back through set_app_workflow (the server verifies)
544
+ \`\`\`
545
+
546
+ \`lotics app pull <app_id>\` also writes these files (alongside the rest of the project).
547
+
548
+ ## What a body is
549
+
550
+ A workflow body is a **JS-subset expression** that runs server-side using workflow
551
+ globals (\`trigger\`, \`runtime\`, tool calls) and ends with \`return({ data })\`. Each
552
+ pulled file wraps the body in the server's \`__workflow\` envelope and references its
553
+ 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:
556
+
557
+ \`\`\`bash
558
+ tsc -p tsconfig.workflows.json # same verdict the server gives on \`set\`
559
+ \`\`\`
560
+
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
563
+ verification that matters still runs on the **server** when you \`set\` — the same
564
+ guarantee as authoring via \`set_app_workflow\` directly. Edit only the body BETWEEN
565
+ the wrapper lines; the wrapper, the \`/// <reference>\`, and the \`export {};\` marker
566
+ are CLI bookkeeping (stripped on \`set\`). Do not rename a file (the filename is the
567
+ alias the binding is keyed by).
568
+
569
+ ## Authority
570
+
571
+ \`lotics app deploy\` never authors workflows — it carries code, queries, and
572
+ capabilities only. \`apps.workflows\` has exactly one author: \`set_app_workflow\`
573
+ (which \`lotics app workflow set\` calls). The typed \`inputs\`/\`outputs\` schema for
574
+ each alias lives in \`package.json#lotics.workflows.<alias>\`.
486
575
  `,
487
576
  },
488
577
  {
@@ -97,4 +97,15 @@ 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/**/*");
110
+ });
100
111
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.57.0",
3
+ "version": "0.60.1",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@lotics/docx": "*",
24
+ "@lotics/shared": "*",
24
25
  "@lotics/xlsx": "*",
25
26
  "@types/node": "^22.15.21",
26
27
  "esbuild": "^0.28.1",