@lotics/cli 0.57.0 → 0.62.0
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.
- package/README.md +37 -0
- package/dist/app_commands.d.ts +165 -2
- package/dist/app_commands.js +803 -7
- package/dist/app_commands.test.js +569 -2
- package/dist/app_workflow_check.d.ts +77 -0
- package/dist/app_workflow_check.js +169 -0
- package/dist/app_workflow_check.test.d.ts +1 -0
- package/dist/app_workflow_check.test.js +166 -0
- package/dist/args.d.ts +4 -0
- package/dist/args.js +9 -0
- package/dist/args.test.js +12 -0
- package/dist/child_env.d.ts +13 -0
- package/dist/child_env.js +24 -0
- package/dist/cli.js +144 -30
- package/dist/client.d.ts +58 -0
- package/dist/client.js +85 -0
- package/dist/dev/server.js +2 -1
- package/dist/generate_app_fields.d.ts +54 -0
- package/dist/generate_app_fields.js +148 -0
- package/dist/generate_app_fields.test.d.ts +1 -0
- package/dist/generate_app_fields.test.js +108 -0
- package/dist/inputs.d.ts +38 -0
- package/dist/inputs.js +50 -0
- package/dist/inputs.test.d.ts +1 -0
- package/dist/inputs.test.js +89 -0
- package/dist/src/cli.js +1208 -187
- package/dist/starter_template.js +72 -2
- package/dist/starter_template.test.js +15 -0
- package/package.json +3 -1
package/dist/starter_template.js
CHANGED
|
@@ -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
|
-
|
|
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
|
},
|
|
@@ -147,7 +149,18 @@ export function buildStarterTemplate(args) {
|
|
|
147
149
|
// fall to `unknown`. The explicit glob makes the dot-dir the non-wildcard
|
|
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:
|
|
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"],
|
|
151
164
|
}, null, 2) + "\n",
|
|
152
165
|
},
|
|
153
166
|
{
|
|
@@ -483,6 +496,63 @@ const routes = [
|
|
|
483
496
|
export default function App() {
|
|
484
497
|
return <AppRouter routes={routes} />;
|
|
485
498
|
}
|
|
499
|
+
`,
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
// The home for editable workflow bodies. `lotics app pull` writes one
|
|
503
|
+
// `src/workflows/<alias>.ts` per bound workflow (faithful server source);
|
|
504
|
+
// edit it, then `lotics app workflow set <alias>` pushes it back through
|
|
505
|
+
// set_app_workflow (the server verifies). A new app has no bound workflows
|
|
506
|
+
// yet, so this is just the docked directory + the loop reference. It's a
|
|
507
|
+
// .md (not a .ts) so tsc's `include: ["src"]` never tries to compile it —
|
|
508
|
+
// a workflow body is a JS-subset expression over server globals
|
|
509
|
+
// (trigger / runtime / tool calls) that does NOT typecheck standalone.
|
|
510
|
+
path: "src/workflows/README.md",
|
|
511
|
+
content: `# Workflow bodies
|
|
512
|
+
|
|
513
|
+
Editable JS-subset bodies of this app's workflows live here, one file per alias:
|
|
514
|
+
\`src/workflows/<alias>.ts\`.
|
|
515
|
+
|
|
516
|
+
## Loop
|
|
517
|
+
|
|
518
|
+
\`\`\`bash
|
|
519
|
+
lotics app workflow pull # write/refresh every src/workflows/<alias>.ts from the server
|
|
520
|
+
# edit src/workflows/<alias>.ts
|
|
521
|
+
lotics app workflow check <alias> # typecheck the body locally (same verdict as \`set\`)
|
|
522
|
+
lotics app workflow set <alias> # push it back through set_app_workflow (the server verifies)
|
|
523
|
+
\`\`\`
|
|
524
|
+
|
|
525
|
+
\`lotics app pull <app_id>\` also writes these files (alongside the rest of the project).
|
|
526
|
+
|
|
527
|
+
## What a body is
|
|
528
|
+
|
|
529
|
+
A workflow body is a **JS-subset expression** that runs server-side using workflow
|
|
530
|
+
globals (\`trigger\`, \`runtime\`, tool calls) and ends with \`return({ data })\`. Each
|
|
531
|
+
pulled file wraps the body in the server's \`__workflow\` envelope and references its
|
|
532
|
+
per-alias ambient globals at \`.lotics/workflows/<alias>.globals.d.ts\`, so it **is**
|
|
533
|
+
locally typecheckable:
|
|
534
|
+
|
|
535
|
+
\`\`\`bash
|
|
536
|
+
lotics app workflow check # check every body; [alias] to check one
|
|
537
|
+
\`\`\`
|
|
538
|
+
|
|
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
|
|
544
|
+
verification that matters still runs on the **server** when you \`set\` — the same
|
|
545
|
+
guarantee as authoring via \`set_app_workflow\` directly. Edit only the body BETWEEN
|
|
546
|
+
the wrapper lines; the wrapper, the \`/// <reference>\`, and the \`export {};\` marker
|
|
547
|
+
are CLI bookkeeping (stripped on \`set\`). Do not rename a file (the filename is the
|
|
548
|
+
alias the binding is keyed by).
|
|
549
|
+
|
|
550
|
+
## Authority
|
|
551
|
+
|
|
552
|
+
\`lotics app deploy\` never authors workflows — it carries code, queries, and
|
|
553
|
+
capabilities only. \`apps.workflows\` has exactly one author: \`set_app_workflow\`
|
|
554
|
+
(which \`lotics app workflow set\` calls). The typed \`inputs\`/\`outputs\` schema for
|
|
555
|
+
each alias lives in \`package.json#lotics.workflows.<alias>\`.
|
|
486
556
|
`,
|
|
487
557
|
},
|
|
488
558
|
{
|
|
@@ -97,4 +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("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();
|
|
114
|
+
});
|
|
100
115
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotics/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "Lotics SDK and CLI for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,9 +21,11 @@
|
|
|
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",
|
|
28
|
+
"typescript": "^6.0.3",
|
|
27
29
|
"vitest": "^4.1.7"
|
|
28
30
|
},
|
|
29
31
|
"keywords": [
|