@lotics/cli 0.182.0 → 0.183.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 +2 -1
- package/dist/src/cli.js +57 -88
- package/dist/src/client.d.ts +22 -42
- package/dist/src/client.js +15 -17
- package/docs/cli_reference.md +3 -3
- package/docs/knowledge_docs.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -334,7 +334,8 @@ lotics run run_app_agent '{...}' --json # full run summary to stdou
|
|
|
334
334
|
# A run that outlives the call's bounded wait keeps going server-side; read it with
|
|
335
335
|
lotics run get_app_agent_run '{"app_id":"app_abc","run_id":"run_..."}'
|
|
336
336
|
|
|
337
|
-
# Dev-link @lotics/ui to a monorepo checkout for ONE command — nothing
|
|
337
|
+
# Dev-link @lotics/ui to a monorepo checkout for ONE command — nothing hand-written is touched
|
|
338
|
+
# (the matching tsc `paths` land in the CLI's own .lotics/tsconfig.link.json)
|
|
338
339
|
LOTICS_UI_SRC=/abs/monorepo/packages/ui/src lotics app dev
|
|
339
340
|
LOTICS_UI_SRC=/abs/monorepo/packages/ui/src lotics app deploy -m "..." # warns: bundles YOUR kit copy
|
|
340
341
|
lotics app dev # unset ⇒ @lotics/ui resolves from node_modules again
|
package/dist/src/cli.js
CHANGED
|
@@ -44516,14 +44516,13 @@ var LoticsClient = class {
|
|
|
44516
44516
|
return this.request("POST", "/v1/apps", body);
|
|
44517
44517
|
}
|
|
44518
44518
|
/**
|
|
44519
|
-
*
|
|
44520
|
-
* unpublish`
|
|
44521
|
-
*
|
|
44522
|
-
*
|
|
44523
|
-
* admin-only.
|
|
44519
|
+
* Take a starter off the shelf, or `undo` to put it back (backs `opctl
|
|
44520
|
+
* starter unpublish`). It hides from non-owning orgs and can no longer be
|
|
44521
|
+
* copied; copies already made are unaffected — they never linked back.
|
|
44522
|
+
* Owner-org admin-only.
|
|
44524
44523
|
*/
|
|
44525
|
-
async
|
|
44526
|
-
return this.request("POST", `/v1/
|
|
44524
|
+
async unpublishStarter(starter_id, body) {
|
|
44525
|
+
return this.request("POST", `/v1/starters/${encodeURIComponent(starter_id)}/unpublish`, body);
|
|
44527
44526
|
}
|
|
44528
44527
|
/**
|
|
44529
44528
|
* Edit a starter's registry listing — the name and description a stranger
|
|
@@ -44532,13 +44531,12 @@ var LoticsClient = class {
|
|
|
44532
44531
|
* A version is an immutable snapshot; the listing is not. Omit a field to
|
|
44533
44532
|
* leave it, pass `description: null` to clear it. Owner-org admin-only.
|
|
44534
44533
|
*/
|
|
44535
|
-
async
|
|
44536
|
-
return this.request("POST", `/v1/
|
|
44534
|
+
async editStarterListing(starter_id, body) {
|
|
44535
|
+
return this.request("POST", `/v1/starters/${encodeURIComponent(starter_id)}/listing`, body);
|
|
44537
44536
|
}
|
|
44538
44537
|
// --- Starters (registry reads + copies) ---
|
|
44539
|
-
// Authoring is server-side
|
|
44540
|
-
//
|
|
44541
|
-
// no client-side create-package / upload-bundle path.
|
|
44538
|
+
// Authoring is server-side, through the publish job (`requestStarterPublish`).
|
|
44539
|
+
// There is no client-side create-starter / upload-bundle path.
|
|
44542
44540
|
/**
|
|
44543
44541
|
* The starters this organization can copy — Lotics-reviewed ones plus its own,
|
|
44544
44542
|
* never a catalogue of everything published. The server returns exactly what
|
|
@@ -44597,12 +44595,12 @@ var LoticsClient = class {
|
|
|
44597
44595
|
* Fetch a registry starter's metadata (`latest_version` and the Lotics-backed
|
|
44598
44596
|
* `is_official` trust badge). Admin-only; cross-tenant by id.
|
|
44599
44597
|
*/
|
|
44600
|
-
async
|
|
44601
|
-
return this.request("GET", `/v1/
|
|
44598
|
+
async getStarter(starter_id) {
|
|
44599
|
+
return this.request("GET", `/v1/starters/${encodeURIComponent(starter_id)}`);
|
|
44602
44600
|
}
|
|
44603
|
-
/** Version history newest-first (no contract payloads) — backs `opctl
|
|
44604
|
-
async
|
|
44605
|
-
return this.request("GET", `/v1/
|
|
44601
|
+
/** Version history newest-first (no contract payloads) — backs `opctl starter show`. Admin-only. */
|
|
44602
|
+
async listStarterVersions(starter_id) {
|
|
44603
|
+
return this.request("GET", `/v1/starters/${encodeURIComponent(starter_id)}/versions`);
|
|
44606
44604
|
}
|
|
44607
44605
|
/**
|
|
44608
44606
|
* Workspace-wide dangling-reference sweep — active app/workflow artifacts
|
|
@@ -45681,7 +45679,7 @@ function resultSideEffects(result) {
|
|
|
45681
45679
|
}
|
|
45682
45680
|
|
|
45683
45681
|
// src/version.ts
|
|
45684
|
-
var VERSION = "0.
|
|
45682
|
+
var VERSION = "0.183.0";
|
|
45685
45683
|
|
|
45686
45684
|
// src/timezone.ts
|
|
45687
45685
|
function machineTimezone() {
|
|
@@ -45892,7 +45890,8 @@ var COMMANDS = [
|
|
|
45892
45890
|
" lotics starter list Starters you can copy into this workspace. Works with",
|
|
45893
45891
|
" NO account \u2014 it then lists the published shelf, so you",
|
|
45894
45892
|
" can decide whether to copy one or build before signing up",
|
|
45895
|
-
" lotics starter show <starter_id>
|
|
45893
|
+
" lotics starter show <starter_id> Its name, description, current version, tile and trust",
|
|
45894
|
+
" standing \u2014 read it before copying one you did not publish",
|
|
45896
45895
|
" lotics starter init <starter_id> Copy it in \u2014 schema, templates, knowledge docs,",
|
|
45897
45896
|
" sample records and its apps, deployed on Lotics. A",
|
|
45898
45897
|
" COPY: everything it creates is yours outright, with",
|
|
@@ -45915,7 +45914,7 @@ var COMMANDS = [
|
|
|
45915
45914
|
{
|
|
45916
45915
|
verbs: ["docs"],
|
|
45917
45916
|
help: [
|
|
45918
|
-
" lotics docs List the reference docs
|
|
45917
|
+
" lotics docs List the reference docs the npm packages in node_modules ship",
|
|
45919
45918
|
" lotics docs <area> Print one (e.g. 'lotics docs ai')"
|
|
45920
45919
|
]
|
|
45921
45920
|
},
|
|
@@ -46464,10 +46463,10 @@ export default defineConfig({
|
|
|
46464
46463
|
// openly at the asset layer \u2014 the map would expose the very source the gate
|
|
46465
46464
|
// exists to protect. Source maps aren't needed to run the app.
|
|
46466
46465
|
sourcemap: false,
|
|
46467
|
-
//
|
|
46468
|
-
//
|
|
46469
|
-
//
|
|
46470
|
-
//
|
|
46466
|
+
// Vite's default 'modules' baseline is es2020, which is older than the
|
|
46467
|
+
// browsers a Lotics app is served to and older than what dev already
|
|
46468
|
+
// transforms at (esnext). Pinned so the prod build does not silently
|
|
46469
|
+
// down-level past a feature the dev server accepted.
|
|
46471
46470
|
target: "es2022",
|
|
46472
46471
|
},
|
|
46473
46472
|
server: {
|
|
@@ -46490,10 +46489,10 @@ export default defineConfig({
|
|
|
46490
46489
|
},
|
|
46491
46490
|
test: {
|
|
46492
46491
|
environment: "jsdom",
|
|
46493
|
-
// Global test setup, run before every test file
|
|
46494
|
-
//
|
|
46495
|
-
//
|
|
46496
|
-
// every test
|
|
46492
|
+
// Global test setup, run before every test file. Ships empty \u2014 the slot is
|
|
46493
|
+
// the author's (custom matchers, a fetch stub, timezone pinning). It must
|
|
46494
|
+
// EXIST either way: setupFiles naming a missing file makes vitest fail to
|
|
46495
|
+
// load every test. See vitest.setup.ts.
|
|
46497
46496
|
setupFiles: ["./${VITEST_SETUP_FILENAME}"],
|
|
46498
46497
|
// RN packages ship Flow (\`import typeof\`) in their native source, reached
|
|
46499
46498
|
// transitively by RN-Web components (pickers, calendars, anything touching
|
|
@@ -46861,18 +46860,12 @@ declare module "*.css";
|
|
|
46861
46860
|
{
|
|
46862
46861
|
path: "src/harness.test.ts",
|
|
46863
46862
|
content: `import { describe, test, expect } from "vitest";
|
|
46864
|
-
import { getAppBinding } from "@lotics/app-sdk";
|
|
46865
46863
|
|
|
46866
46864
|
/**
|
|
46867
46865
|
* The one test the scaffold seeds, and it is about the TEST SETUP rather than
|
|
46868
46866
|
* about your app \u2014 so editing src/App.tsx can never break it, and \`npm test\`
|
|
46869
|
-
* never has to be green over zero tests.
|
|
46870
|
-
*
|
|
46871
|
-
* What it pins: tests run under jsdom, and vitest.setup.ts's echo stub answers
|
|
46872
|
-
* for \`getAppBinding\`. That second one is the whole reason the setup file
|
|
46873
|
-
* exists: a package-linked app's generated .lotics/app_fields.ts awaits it while
|
|
46874
|
-
* a test file is still COLLECTING, so without the stub every test fails before
|
|
46875
|
-
* any of them runs \u2014 including pure logic tests that never touch a field id.
|
|
46867
|
+
* never has to be green over zero tests. It imports nothing of yours and
|
|
46868
|
+
* nothing generated, so it passes on a fresh clone before any codegen has run.
|
|
46876
46869
|
*
|
|
46877
46870
|
* Delete it once you have tests of your own, or keep it; it costs nothing.
|
|
46878
46871
|
*/
|
|
@@ -46880,13 +46873,6 @@ describe("test harness", () => {
|
|
|
46880
46873
|
test("runs in a DOM", () => {
|
|
46881
46874
|
expect(typeof document).toBe("object");
|
|
46882
46875
|
});
|
|
46883
|
-
|
|
46884
|
-
test("resolves the app binding from the setup stub, so the app graph collects", async () => {
|
|
46885
|
-
const binding = await getAppBinding();
|
|
46886
|
-
// The echo stub answers any alias with a self-identifying ':test:' id \u2014 one
|
|
46887
|
-
// that can never be mistaken for a real fld_\u2026 from the workspace.
|
|
46888
|
-
expect(binding.fields["anything.at.all"]).toContain(":test:");
|
|
46889
|
-
});
|
|
46890
46876
|
});
|
|
46891
46877
|
`
|
|
46892
46878
|
},
|
|
@@ -74085,7 +74071,7 @@ async function starterList(client) {
|
|
|
74085
74071
|
description: s.description,
|
|
74086
74072
|
tags: [
|
|
74087
74073
|
s.is_official ? "official" : null,
|
|
74088
|
-
s.owned_by_caller
|
|
74074
|
+
s.owned_by_caller ? "yours" : null
|
|
74089
74075
|
].filter((t) => t !== null)
|
|
74090
74076
|
}))
|
|
74091
74077
|
);
|
|
@@ -74093,19 +74079,17 @@ async function starterList(client) {
|
|
|
74093
74079
|
lotics starter init <starter_id> Copy one into this workspace`);
|
|
74094
74080
|
}
|
|
74095
74081
|
async function starterShow(client, starter_id) {
|
|
74096
|
-
const starter = await client.
|
|
74082
|
+
const starter = await client.getStarter(starter_id);
|
|
74097
74083
|
console.log(`${starter.name} (${starter.id})`);
|
|
74098
74084
|
if (starter.description) console.log(starter.description);
|
|
74099
74085
|
console.log(
|
|
74100
74086
|
`
|
|
74101
|
-
version
|
|
74102
|
-
trust
|
|
74087
|
+
version ${starter.latest_version}
|
|
74088
|
+
trust ${starter.is_official ? "official \u2014 reviewed by Lotics" : starter.owned_by_caller ? "your organization's own" : "not copyable from this organization"}`
|
|
74103
74089
|
);
|
|
74104
|
-
|
|
74105
|
-
console.log(`icon ${starter.icon ?? "none \u2014 copies show a generic tile"}`);
|
|
74106
|
-
}
|
|
74090
|
+
console.log(`icon ${starter.icon ?? "none \u2014 the shelf shows a generic tile"}`);
|
|
74107
74091
|
if (starter.retired_at !== null) {
|
|
74108
|
-
console.log(`
|
|
74092
|
+
console.log(`unpublished ${starter.retired_at} \u2014 can no longer be copied`);
|
|
74109
74093
|
}
|
|
74110
74094
|
}
|
|
74111
74095
|
function reportKnowledgeWarnings(warnings) {
|
|
@@ -74119,26 +74103,15 @@ function reportKnowledgeWarnings(warnings) {
|
|
|
74119
74103
|
answering from nowhere. Create them with those names, or edit the agent.`
|
|
74120
74104
|
);
|
|
74121
74105
|
}
|
|
74122
|
-
function instantiateBody(args) {
|
|
74123
|
-
return {
|
|
74124
|
-
...args.noSampleData === true ? { no_sample_data: true } : {},
|
|
74125
|
-
...args.adopt === true ? { adopt: true } : {},
|
|
74126
|
-
build_on_server: true
|
|
74127
|
-
};
|
|
74128
|
-
}
|
|
74129
74106
|
async function starterInit(client, args) {
|
|
74130
|
-
const starter = await client.
|
|
74107
|
+
const starter = await client.getStarter(args.starter_id);
|
|
74131
74108
|
note(
|
|
74132
74109
|
`Copying ${starter.name}${starter.is_official ? " (official)" : ""} into this workspace\u2026`
|
|
74133
74110
|
);
|
|
74134
|
-
const result = await client.instantiateStarter(args.starter_id,
|
|
74135
|
-
|
|
74136
|
-
|
|
74137
|
-
|
|
74138
|
-
The copy itself landed \u2014 open it with "lotics auth web" \u2014 and retry once the platform
|
|
74139
|
-
deploy completes. Do NOT copy again.`
|
|
74140
|
-
);
|
|
74141
|
-
}
|
|
74111
|
+
const result = await client.instantiateStarter(args.starter_id, {
|
|
74112
|
+
...args.noSampleData === true ? { no_sample_data: true } : {},
|
|
74113
|
+
...args.adopt === true ? { adopt: true } : {}
|
|
74114
|
+
});
|
|
74142
74115
|
const tables = Object.keys(result.binding.entities ?? {}).sort();
|
|
74143
74116
|
const knowledgeDocs = Object.keys(result.binding.knowledge ?? {}).sort();
|
|
74144
74117
|
const templates = Object.keys(result.binding.templates ?? {}).sort();
|
|
@@ -74152,24 +74125,10 @@ async function starterInit(client, args) {
|
|
|
74152
74125
|
error: app.error
|
|
74153
74126
|
}));
|
|
74154
74127
|
note(
|
|
74155
|
-
` Created ${tables.length} table${tables.length === 1 ? "" : "s"}, ${templates.length} template${templates.length === 1 ? "" : "s"}, ${knowledgeDocs.length} knowledge doc${knowledgeDocs.length === 1 ? "" : "s"}, ${records} sample record${records === 1 ? "" : "s"}
|
|
74128
|
+
` Created ${tables.length} table${tables.length === 1 ? "" : "s"}, ${templates.length} template${templates.length === 1 ? "" : "s"}, ${knowledgeDocs.length} knowledge doc${knowledgeDocs.length === 1 ? "" : "s"}, ${records} sample record${records === 1 ? "" : "s"}, ${apps.length} app${apps.length === 1 ? "" : "s"}.`
|
|
74156
74129
|
);
|
|
74157
74130
|
reportKnowledgeWarnings(result.knowledge_warnings);
|
|
74158
|
-
|
|
74159
|
-
starter_id: args.starter_id,
|
|
74160
|
-
starter_name: starter.name,
|
|
74161
|
-
version: result.version,
|
|
74162
|
-
app_ids: Object.fromEntries(apps.map((app) => [app.alias, app.app_id])),
|
|
74163
|
-
apps,
|
|
74164
|
-
created
|
|
74165
|
-
};
|
|
74166
|
-
if (apps.length === 0) {
|
|
74167
|
-
note(`
|
|
74168
|
-
Done \u2014 these are yours now, with no link back to the starter.`);
|
|
74169
|
-
noteCopiedContent(templates, knowledgeDocs);
|
|
74170
|
-
return { ...base, signin_url: null };
|
|
74171
|
-
}
|
|
74172
|
-
if (starter.owned_by_caller !== true) {
|
|
74131
|
+
if (!starter.owned_by_caller) {
|
|
74173
74132
|
warn(
|
|
74174
74133
|
`
|
|
74175
74134
|
${starter.name} is the publisher's code \u2014 its apps, workflows and agents \u2014 and runs in
|
|
@@ -74207,9 +74166,11 @@ ${failed.length} app${failed.length === 1 ? "" : "s"} landed without a version:
|
|
|
74207
74166
|
signInUrl = null;
|
|
74208
74167
|
}
|
|
74209
74168
|
note(
|
|
74210
|
-
`
|
|
74169
|
+
(apps.length > 0 && failed.length === apps.length ? `
|
|
74170
|
+
${starter.name} landed, but none of its ${apps.length} app${apps.length === 1 ? "" : "s"} is live.
|
|
74171
|
+
` : `
|
|
74211
74172
|
Done \u2014 ${starter.name} is live and yours.
|
|
74212
|
-
|
|
74173
|
+
`) + `
|
|
74213
74174
|
Edit anything: the tables, the apps, the templates, the docs. There is no link
|
|
74214
74175
|
back to the starter and nothing to upgrade \u2014 this is your workspace now.
|
|
74215
74176
|
Change an app's code: lotics app pull <app_id> (then lotics app deploy -m "<what changed>")
|
|
@@ -74228,7 +74189,15 @@ Done \u2014 ${starter.name} is live and yours.
|
|
|
74228
74189
|
Open it \u2014 one-time sign-in link, expires in 15 minutes:
|
|
74229
74190
|
${signInUrl}`);
|
|
74230
74191
|
}
|
|
74231
|
-
return {
|
|
74192
|
+
return {
|
|
74193
|
+
starter_id: args.starter_id,
|
|
74194
|
+
starter_name: starter.name,
|
|
74195
|
+
version: result.version,
|
|
74196
|
+
app_ids: Object.fromEntries(apps.map((app) => [app.alias, app.app_id])),
|
|
74197
|
+
apps,
|
|
74198
|
+
created,
|
|
74199
|
+
signin_url: signInUrl
|
|
74200
|
+
};
|
|
74232
74201
|
}
|
|
74233
74202
|
async function starterFixturesCapture(client, args) {
|
|
74234
74203
|
const projectDir = path10.resolve(args.projectDir ?? process.cwd());
|
|
@@ -103582,7 +103551,7 @@ async function main() {
|
|
|
103582
103551
|
console.error(
|
|
103583
103552
|
`--version prints this CLI's version and takes no argument; it cannot be combined with a command.
|
|
103584
103553
|
The CLI version: lotics --version
|
|
103585
|
-
A
|
|
103554
|
+
A starter's version: a copy always takes the latest; there is no flag for an older one.`
|
|
103586
103555
|
);
|
|
103587
103556
|
process.exit(1);
|
|
103588
103557
|
}
|
|
@@ -103606,7 +103575,7 @@ async function main() {
|
|
|
103606
103575
|
const email3 = flags.email ?? (process.stdin.isTTY ? await prompt("Email: ") : "");
|
|
103607
103576
|
if (!email3) {
|
|
103608
103577
|
console.error(
|
|
103609
|
-
"This machine has no Lotics credential yet, so `
|
|
103578
|
+
"This machine has no Lotics credential yet, so `setup` needs an email to create one:\n lotics setup " + starterId + " --email you@company.com"
|
|
103610
103579
|
);
|
|
103611
103580
|
process.exit(1);
|
|
103612
103581
|
}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export interface FileUploadResult {
|
|
|
114
114
|
error: string;
|
|
115
115
|
}>;
|
|
116
116
|
}
|
|
117
|
-
/** One finding from a
|
|
117
|
+
/** One finding from the extract behind a starter publish. */
|
|
118
118
|
export interface ExtractFinding {
|
|
119
119
|
severity: "error" | "warning" | "info";
|
|
120
120
|
area: string;
|
|
@@ -140,7 +140,7 @@ export interface StarterPublishRequest {
|
|
|
140
140
|
color?: string;
|
|
141
141
|
}
|
|
142
142
|
export interface StarterPublishPreview {
|
|
143
|
-
/** The starter this would
|
|
143
|
+
/** The starter this would publish into, or null when it would mint one. */
|
|
144
144
|
starter_id: string | null;
|
|
145
145
|
starter_name: string;
|
|
146
146
|
version: number;
|
|
@@ -149,7 +149,7 @@ export interface StarterPublishPreview {
|
|
|
149
149
|
app_id: string;
|
|
150
150
|
name: string;
|
|
151
151
|
}>;
|
|
152
|
-
/** Empty
|
|
152
|
+
/** Empty after v1 — the aliases froze there. */
|
|
153
153
|
renamable_aliases: {
|
|
154
154
|
entities: string[];
|
|
155
155
|
fields: string[];
|
|
@@ -182,7 +182,7 @@ export interface StarterPublish {
|
|
|
182
182
|
started_at: string | null;
|
|
183
183
|
finished_at: string | null;
|
|
184
184
|
}
|
|
185
|
-
/** Advisory knowledge warnings surfaced by
|
|
185
|
+
/** Advisory knowledge warnings surfaced by a copy (never block). */
|
|
186
186
|
export interface KnowledgeWarnings {
|
|
187
187
|
/** `knowledge_expects` doc names with no matching workspace doc. */
|
|
188
188
|
missing_expected_docs: string[];
|
|
@@ -406,13 +406,12 @@ export declare class LoticsClient {
|
|
|
406
406
|
current_version_id: string | null;
|
|
407
407
|
}>;
|
|
408
408
|
/**
|
|
409
|
-
*
|
|
410
|
-
* unpublish`
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
* admin-only.
|
|
409
|
+
* Take a starter off the shelf, or `undo` to put it back (backs `opctl
|
|
410
|
+
* starter unpublish`). It hides from non-owning orgs and can no longer be
|
|
411
|
+
* copied; copies already made are unaffected — they never linked back.
|
|
412
|
+
* Owner-org admin-only.
|
|
414
413
|
*/
|
|
415
|
-
|
|
414
|
+
unpublishStarter(starter_id: string, body: {
|
|
416
415
|
undo: boolean;
|
|
417
416
|
}): Promise<{
|
|
418
417
|
id: string;
|
|
@@ -426,7 +425,7 @@ export declare class LoticsClient {
|
|
|
426
425
|
* A version is an immutable snapshot; the listing is not. Omit a field to
|
|
427
426
|
* leave it, pass `description: null` to clear it. Owner-org admin-only.
|
|
428
427
|
*/
|
|
429
|
-
|
|
428
|
+
editStarterListing(starter_id: string, body: {
|
|
430
429
|
name?: string;
|
|
431
430
|
description?: string | null;
|
|
432
431
|
icon?: string | null;
|
|
@@ -437,11 +436,8 @@ export declare class LoticsClient {
|
|
|
437
436
|
id: string;
|
|
438
437
|
name: string;
|
|
439
438
|
description: string | null;
|
|
440
|
-
icon
|
|
441
|
-
|
|
442
|
-
theme?: {
|
|
443
|
-
color?: string | null;
|
|
444
|
-
} | null;
|
|
439
|
+
icon: string | null;
|
|
440
|
+
theme: Record<string, unknown> | null;
|
|
445
441
|
}>;
|
|
446
442
|
/**
|
|
447
443
|
* The starters this organization can copy — Lotics-reviewed ones plus its own,
|
|
@@ -454,7 +450,7 @@ export declare class LoticsClient {
|
|
|
454
450
|
description: string | null;
|
|
455
451
|
latest_version: number;
|
|
456
452
|
is_official: boolean;
|
|
457
|
-
owned_by_caller
|
|
453
|
+
owned_by_caller: boolean;
|
|
458
454
|
}>>;
|
|
459
455
|
/**
|
|
460
456
|
* Copy a starter into the current workspace.
|
|
@@ -469,12 +465,6 @@ export declare class LoticsClient {
|
|
|
469
465
|
version?: number;
|
|
470
466
|
no_sample_data?: boolean;
|
|
471
467
|
adopt?: boolean;
|
|
472
|
-
/**
|
|
473
|
-
* An echo for the rollout window: a server one release behind deploys
|
|
474
|
-
* only when asked, and this CLI cannot build a copy itself. Drop it once
|
|
475
|
-
* no such server is a rollback target.
|
|
476
|
-
*/
|
|
477
|
-
build_on_server?: boolean;
|
|
478
468
|
}): Promise<{
|
|
479
469
|
/** Each app's deploy, in contract order. `error` set and `deployed` null when one did not land. */
|
|
480
470
|
apps: Array<{
|
|
@@ -491,9 +481,7 @@ export declare class LoticsClient {
|
|
|
491
481
|
version: number;
|
|
492
482
|
binding: Record<string, Record<string, string>>;
|
|
493
483
|
sample_record_ids: Record<string, string[]>;
|
|
494
|
-
knowledge_warnings:
|
|
495
|
-
missing_expected_docs: string[];
|
|
496
|
-
};
|
|
484
|
+
knowledge_warnings: KnowledgeWarnings;
|
|
497
485
|
}>;
|
|
498
486
|
/**
|
|
499
487
|
* Which starter this app is the origin of. 404 when it has published none.
|
|
@@ -536,34 +524,26 @@ export declare class LoticsClient {
|
|
|
536
524
|
* Fetch a registry starter's metadata (`latest_version` and the Lotics-backed
|
|
537
525
|
* `is_official` trust badge). Admin-only; cross-tenant by id.
|
|
538
526
|
*/
|
|
539
|
-
|
|
527
|
+
getStarter(starter_id: string): Promise<{
|
|
540
528
|
id: string;
|
|
541
529
|
name: string;
|
|
542
530
|
description: string | null;
|
|
543
531
|
latest_version: number;
|
|
544
532
|
is_official: boolean;
|
|
545
533
|
retired_at: string | null;
|
|
546
|
-
/**
|
|
547
|
-
owned_by_caller
|
|
548
|
-
/**
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
* Optional for the same reason `owned_by_caller` is: a server that predates
|
|
552
|
-
* the field answers without it, and a CLI newer than the deployment it is
|
|
553
|
-
* talking to must read that as "not stated" rather than "not set".
|
|
554
|
-
*/
|
|
555
|
-
icon?: string | null;
|
|
556
|
-
theme?: Record<string, unknown> | null;
|
|
534
|
+
/** Whether the CALLING org owns it — the copy-time trust badge, without exposing the owner's org id. */
|
|
535
|
+
owned_by_caller: boolean;
|
|
536
|
+
/** The shelf tile. Null = unset; a copy's app tiles come from the contract. */
|
|
537
|
+
icon: string | null;
|
|
538
|
+
theme: Record<string, unknown> | null;
|
|
557
539
|
created_at: string;
|
|
558
540
|
updated_at: string;
|
|
559
541
|
}>;
|
|
560
|
-
/** Version history newest-first (no contract payloads) — backs `opctl
|
|
561
|
-
|
|
542
|
+
/** Version history newest-first (no contract payloads) — backs `opctl starter show`. Admin-only. */
|
|
543
|
+
listStarterVersions(starter_id: string): Promise<{
|
|
562
544
|
versions: Array<{
|
|
563
545
|
version: number;
|
|
564
546
|
changelog: string | null;
|
|
565
|
-
channel: "release" | "dev";
|
|
566
|
-
yanked_at: string | null;
|
|
567
547
|
created_at: string;
|
|
568
548
|
}>;
|
|
569
549
|
}>;
|
package/dist/src/client.js
CHANGED
|
@@ -324,14 +324,13 @@ export class LoticsClient {
|
|
|
324
324
|
return this.request("POST", "/v1/apps", body);
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
|
-
*
|
|
328
|
-
* unpublish`
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* admin-only.
|
|
327
|
+
* Take a starter off the shelf, or `undo` to put it back (backs `opctl
|
|
328
|
+
* starter unpublish`). It hides from non-owning orgs and can no longer be
|
|
329
|
+
* copied; copies already made are unaffected — they never linked back.
|
|
330
|
+
* Owner-org admin-only.
|
|
332
331
|
*/
|
|
333
|
-
async
|
|
334
|
-
return this.request("POST", `/v1/
|
|
332
|
+
async unpublishStarter(starter_id, body) {
|
|
333
|
+
return this.request("POST", `/v1/starters/${encodeURIComponent(starter_id)}/unpublish`, body);
|
|
335
334
|
}
|
|
336
335
|
/**
|
|
337
336
|
* Edit a starter's registry listing — the name and description a stranger
|
|
@@ -340,13 +339,12 @@ export class LoticsClient {
|
|
|
340
339
|
* A version is an immutable snapshot; the listing is not. Omit a field to
|
|
341
340
|
* leave it, pass `description: null` to clear it. Owner-org admin-only.
|
|
342
341
|
*/
|
|
343
|
-
async
|
|
344
|
-
return this.request("POST", `/v1/
|
|
342
|
+
async editStarterListing(starter_id, body) {
|
|
343
|
+
return this.request("POST", `/v1/starters/${encodeURIComponent(starter_id)}/listing`, body);
|
|
345
344
|
}
|
|
346
345
|
// --- Starters (registry reads + copies) ---
|
|
347
|
-
// Authoring is server-side
|
|
348
|
-
//
|
|
349
|
-
// no client-side create-package / upload-bundle path.
|
|
346
|
+
// Authoring is server-side, through the publish job (`requestStarterPublish`).
|
|
347
|
+
// There is no client-side create-starter / upload-bundle path.
|
|
350
348
|
/**
|
|
351
349
|
* The starters this organization can copy — Lotics-reviewed ones plus its own,
|
|
352
350
|
* never a catalogue of everything published. The server returns exactly what
|
|
@@ -399,12 +397,12 @@ export class LoticsClient {
|
|
|
399
397
|
* Fetch a registry starter's metadata (`latest_version` and the Lotics-backed
|
|
400
398
|
* `is_official` trust badge). Admin-only; cross-tenant by id.
|
|
401
399
|
*/
|
|
402
|
-
async
|
|
403
|
-
return this.request("GET", `/v1/
|
|
400
|
+
async getStarter(starter_id) {
|
|
401
|
+
return this.request("GET", `/v1/starters/${encodeURIComponent(starter_id)}`);
|
|
404
402
|
}
|
|
405
|
-
/** Version history newest-first (no contract payloads) — backs `opctl
|
|
406
|
-
async
|
|
407
|
-
return this.request("GET", `/v1/
|
|
403
|
+
/** Version history newest-first (no contract payloads) — backs `opctl starter show`. Admin-only. */
|
|
404
|
+
async listStarterVersions(starter_id) {
|
|
405
|
+
return this.request("GET", `/v1/starters/${encodeURIComponent(starter_id)}/versions`);
|
|
408
406
|
}
|
|
409
407
|
/**
|
|
410
408
|
* Workspace-wide dangling-reference sweep — active app/workflow artifacts
|
package/docs/cli_reference.md
CHANGED
|
@@ -43,8 +43,8 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
43
43
|
| `lotics app codegen [path]` | Regenerate `.lotics/*` from the manifest + workspace schema **without a deploy**. The three `.d.ts` companions (`app_{workflows,queries,agents}.d.ts`) are always rewritten (synchronous, no network). When credentials resolve, also rewrites the **runtime** `.lotics/app_fields.ts` — a real `.ts` exporting `F` (table→field→`"fld_…"`) + `OPT` (table→select-field→option→`"opt_…"`) keyed by display-name aliases, for the tables the app's queries reference (+ optional `package.json#lotics.codegen.tables` allowlist). **There is one form, and that is what makes a starter's source portable**: the keys are slugified DISPLAY NAMES and a starter carries its labels verbatim, so running codegen in a copy's own workspace emits the same keys pointing at that workspace's ids — no binding fetched at load, no prebuilt bundle to keep in step. Also refreshes each bound workflow's `.lotics/workflows/<alias>.globals.d.ts` + re-wraps its EXISTING `src/workflows/<alias>.ts` body in the current envelope (strips + re-wraps; never re-fetches the body, so local edits survive). **`.lotics/` is reconciled to the manifest, not merely added to** — a `<alias>.globals.d.ts` whose alias the manifest no longer declares is DELETED. Only that exact filename shape is removed; anything else in the directory is left alone. The reconcile runs before the credential branch, so it happens offline too. The authored counterpart is never deleted — a `src/workflows/<alias>.ts` the manifest does not declare is NAMED instead (`check` and `set` both take their alias set from the manifest, so editing an undeclared body is a silent no-op). A getApp / binding / schema / dts-fetch failure is non-fatal (warns, keeps the last-generated files). **Re-silvers `package.json#lotics.agents`** from the live app row whenever its `inputs`/`outputs` disagree, then rewrites the agent `.d.ts` from the refreshed block: that block is a mirror AND the offline seed for `useAgentRun` typings, so a stale copy types the app against an agent that does not exist. The write is surgical and order-preserving, so it changes only the fields that actually differ. A hand edit to that block is therefore reverted — it never changed the agent anyway; to change one, `set_app_agent`. |
|
|
44
44
|
| `lotics setup <starter_id> [--email <addr>] [--json]` | **The whole first run, in one command.** Creates an account when this machine has no credential (the same call `auth signup` makes — `--name` and `--timezone` apply), then does exactly what `starter init` does, then prints the one-time sign-in link. It exists because the two-command form has a seam where the FIRST command exists only to produce a credential for the second, and a caller pasting a prompt has to get both right. **`--email` is only for creating an account**: with a credential already resolvable it is REFUSED rather than obeyed, because the two can name different organizations and preferring either one silently copies a starter into an org the caller did not name — the message says how to do each thing on purpose. Without it, `setup` copies into the account you already have and is a pure alias for `starter init`. A path positional is accepted and IGNORED with a warning — nothing is written to disk any more — so a prompt written for an older CLI still runs. **`--json` prints one object on stdout and nothing else** — `organization_id`, `workspace_id`, `app_ids` (alias → id), `apps` (each app's `version_number`, or its `error`), `signin_url`, and `created` — which NAMES what landed (`tables`, `templates` and `knowledge_docs` are alias arrays; `sample_records` is a row count, since rows are not named things). Aliases rather than counts because the next question is about a particular artifact: a copied template carries the publisher's wording and a copied knowledge doc describes how they work, so "which of these should be mine?" is the conversation a copy starts, and a count cannot begin it. Plus a `warnings` array carrying everything the prose form would have said out of band — an unbindable knowledge doc, a sign-in link that could not be minted, the publisher's-code disclosure, an app that landed without a version. A warning is never merely silenced: when the command fails with an error before it can emit, the ones it had collected go to stderr alongside it. Reachable with no install: `npx -y @lotics/cli setup …`. |
|
|
45
45
|
| `lotics starter list` | **Works with no account**, and that is the point: whether to copy a starter or build from scratch is decided before one exists, so requiring a key would mean signing up to learn the answer was no. Unauthenticated it lists what Lotics publishes (`GET /v1/starters/official`, public). Authenticated it is the org shelf — The starters this organization can copy — Lotics-reviewed ones plus its own, each with at least one released version. Deliberately NOT a catalogue of everything published: the server returns exactly what a copy would be allowed to take, so the list can never offer something that then refuses. Admin-only. |
|
|
46
|
-
| `lotics starter show <starter_id>` | One starter's name, description, current version and trust standing (`official` — reviewed by Lotics; `your organization's own`). Read it before copying a starter you did not publish. |
|
|
47
|
-
| `lotics starter init <starter_id>` | **Copy a starter into this workspace.** Server-side it scaffolds the tables and fields, creates the document templates and knowledge docs, inserts the sample records, creates every app the starter carries and materializes each one's queries, workflows and agents onto it — then deploys each app from the dist the starter was published with, rewriting the publisher's sentinel field keys to this workspace's. No build runs anywhere, nothing is written to this machine, and nothing here needs node: the apps are live when the command returns. **What you get is yours outright**: ordinary apps plus ordinary tables, with no link back to the starter, nothing pinned, and nothing to upgrade. Edit any of it — `lotics app pull <app_id>` is how an app's code is edited afterwards. **The publisher's code runs in your workspace as you** — its apps, workflows and agents — which is why provenance is the gate: **copyable only if the starter is Lotics-reviewed or your own organization published it**, enforced server-side; the disclosure is printed (and carried in `--json`'s `warnings`) whenever the starter is not your own. **Refuses a workspace that already has tables** unless `--adopt`: scaffold matches an entity by DISPLAY NAME, so a starter declaring `Contacts` would bind to yours. An app whose deploy failed is reported by name with its reason and the exit is non-zero, but the copy is complete around it — the tables, the records and the app row exist — so it must not be run again; the publisher fixes the starter and it is copied into a fresh workspace. The sign-in link lands on the app when there is one, else on the workspace's app list. `--json` prints one object on stdout instead of progress (the shape is under `lotics setup`). `--no-sample-data` skips the sample records; with them,
|
|
46
|
+
| `lotics starter show <starter_id>` | One starter's name, description, current version, shelf tile and trust standing (`official` — reviewed by Lotics; `your organization's own`; otherwise `not copyable from this organization`), plus the date it was unpublished once it has been. Read it before copying a starter you did not publish. Admin-only, and readable by id from any org — but an unpublished starter 404s for every org except the one that published it. |
|
|
47
|
+
| `lotics starter init <starter_id>` | **Copy a starter into this workspace.** Server-side it scaffolds the tables and fields, creates the document templates and knowledge docs, inserts the sample records, creates every app the starter carries and materializes each one's queries, workflows and agents onto it — then deploys each app from the dist the starter was published with, rewriting the publisher's sentinel field keys to this workspace's. No build runs anywhere, nothing is written to this machine, and nothing here needs node: the apps are live when the command returns. **What you get is yours outright**: ordinary apps plus ordinary tables, with no link back to the starter, nothing pinned, and nothing to upgrade. Edit any of it — `lotics app pull <app_id>` is how an app's code is edited afterwards. **The publisher's code runs in your workspace as you** — its apps, workflows and agents — which is why provenance is the gate: **copyable only if the starter is Lotics-reviewed or your own organization published it**, enforced server-side; the disclosure is printed (and carried in `--json`'s `warnings`) whenever the starter is not your own. **Refuses a workspace that already has tables** unless `--adopt`: scaffold matches an entity by DISPLAY NAME, so a starter declaring `Contacts` would bind to yours. An app whose deploy failed is reported by name with its reason and the exit is non-zero, but the copy is complete around it — the tables, the records and the app row exist — so it must not be run again; the publisher fixes the starter and it is copied into a fresh workspace. The sign-in link lands on the app when there is one, else on the workspace's app list. `--json` prints one object on stdout instead of progress (the shape is under `lotics setup`). `--no-sample-data` skips the sample records, and a copy that ADOPTS an existing table writes none either — that table already holds real rows, and the fixture set links to itself, so it is all-or-nothing; with them, how many landed is reported. They are ordinary records, delete them whenever. Resolves and ANNOUNCES its workspace first (`lotics → <org> / <workspace>` on stderr). Admin-only. Authoring the registry (`opctl starter publish/unpublish`) stays operator-only. |
|
|
48
48
|
| `lotics starter fixtures capture [--entity <alias> ...] [--limit <n>]` | **(authoring)** Write this app's live records into the project as `fixtures/<entity-alias>.json` — the sample data a starter carries, so a copy lands with something in it. Run from an app project; the app id comes from its manifest. The alias-keyed shape is produced server-side, because the aliases are minted when the starter is extracted and exist nowhere a project can read them. `--entity` is repeatable and comma-separated; omitted, every table the app declares is captured. **Capture a linked set in ONE call** — a link between two rows only resolves within a single capture, so taking companies and contacts separately drops the edge between them (it says so when it happens). `--limit` bounds rows per table (default 10, max 200). **READ WHAT IT WROTE before committing**: these rows are created verbatim in every workspace that copies the starter, so a real customer name, price or address captured here is published. Files, formulas, rollups, lookups and autonumbers are never captured — the platform writes those. Admin-only; writes nothing to the workspace. |
|
|
49
49
|
| `lotics upgrade` | Update this CLI in place. Runs the same installer a person would, chosen by how THIS copy arrived: an npm install upgrades through npm, a script install re-runs the script — the runtime knows which (the executable is compiled, the npm bin runs under node), so nobody has to. It downloads nothing itself; resolving a version, verifying the checksum and replacing a running executable already exist in the installers, and a second copy of that inside the binary would be a second thing to get right. Replacing the binary while it runs is safe — a rename leaves the running image mapped on unix, and on Windows the installer moves the old aside precisely because the file is in use. Already current is a no-op that says so. Needs no auth. |
|
|
50
50
|
| `lotics docs` \| `lotics docs <area>` | The index of the reference docs, **resolved out of the packages installed beside this project** — never carried by this CLI. **Both levels are discovered by looking**: every `@lotics/*` package carrying an `AGENTS.md` or a `docs/` in any `node_modules/@lotics` from the current directory UPWARD (nearest wins, so a hoisted root copy never shadows the one a project's own imports resolve to), and within each, every area it actually ships. Titles come from each file's own `# heading` and the version from the installed `package.json`, so a doc OR a whole package added upstream appears with no change to this CLI, and a skewed install is visible rather than reassuring. A package's index is named after the package (`lotics docs ui`), never `index`. `@lotics/app-sdk`, `@lotics/ui` and `@lotics/cli` sort first as a reading ORDER, not a filter. Both the index and `<area>` print to **stdout** — the index is the payload of a bare `lotics docs`, so `lotics docs | grep -i excel` works — with only the provenance line on stderr, so `lotics docs ai > ai.md` is the doc alone; a name two packages share is refused with both qualified forms (`lotics docs ui/templates`) rather than resolved silently. Needs no auth. Outside a project only `@lotics/cli`'s own resolve, and it says so. |
|
|
@@ -57,7 +57,7 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
57
57
|
| `lotics app workflow check [alias]` | Check the editable workflow bodies locally, no auth / no network, in the **server's own order** — parse, then type-check. **Parse** runs `parseWorkflowJs` from `@lotics/shared` (the SAME module `verifyWorkflow` calls, never a second implementation) over the stripped body `set` would upload, with `toolNames: undefined` (the CLI ships no tool registry, so tool-name resolution stays a server check while every shape/scope rule runs here). A body the subset rejects reports **that error alone** and skips the compiler — it never reaches the server's compiler either, so tsc's opinion of it is noise. **Type-check** then builds an **isolated** `ts.Program` per alias from exactly that alias's `{body, globals}` pair — mirroring the server, which verifies one body at a time — so the per-alias ambient `trigger` never collides and `trigger.app_workflow.inputs` is checked against the right alias. All aliases run in ONE node process (N programs, not N `tsc` spawns), with the SAME compile options the server uses at set-time verify (lib `es2022` with no DOM, target ES2022, strict, NodeNext, `types:[]`, skipLibCheck) and the app's OWN `typescript` (resolved from its `node_modules`, never bundled into the CLI). What the compiler sees is the **checked source**, not the file: `rewriteAccumulatorAppends` from `@lotics/shared` — the SAME transform the server applies before its set-time compile — is applied in memory, so a pulled body's canonical `out = concat(out, [item])` accumulator checks green here exactly as it saves there, and the body on disk is never rewritten. Reports `<file>:<line>:<col> - <TS####\|subset>` at the **physical** line in `src/workflows/<alias>.ts`, so an editor jump lands on the offending code (these are deliberately NOT `set`'s body-relative numbers — `set` prints no file path, so there is no format to agree with); exits non-zero if any alias fails. Green is honest but not total: `set` additionally resolves names, lints and structurally validates against the live workspace — passes that need its tables and tool schemas, so they cannot run offline, and the success line says so. A bound alias with no body file yet warns + skips; a body with no globals errors (naming `lotics app codegen`, which refreshes types WITHOUT touching the body — a pull would overwrite it). **It also keeps the types honest.** Each alias's `.lotics/workflows/<alias>.globals.d.ts` carries a `// lotics:declaration <hash>` stamp of the manifest declaration it was rendered from; `check` compares it to `package.json#lotics.workflows.<alias>` and, when they differ, re-renders that alias's dts from the LOCAL declaration before compiling. Without it the verdict was confidently wrong in the exact case an author needs it — declare an input, run `check`, and get `TS2339: Property 'x' does not exist` pointing at your body for a schema the types have never been told about. The server renders a dts from a SUPPLIED declaration, so this works before the manifest has ever been deployed, which is when it matters (the order is edit → check → set). This is the ONE thing `check` uses the API for: it is skipped entirely when the stamps match (the common case, so `check` stays instant and offline), and with no credentials or a failed fetch it WARNS and checks against the older types rather than blocking. A file written before the stamp existed reads as unknown, never as matching, so a pre-existing checkout heals on its first run. |
|
|
58
58
|
| `lotics app subdomain <new-subdomain>` | Rename the app's public `<slug>.lotics.app` address via `PUT /v1/apps/{id}/subdomain`. app_id comes from the local `package.json` manifest; the chosen slug must be a valid DNS label and free; the old address stops resolving. |
|
|
59
59
|
| `lotics app rename "<new name>"` | Change the app's display name (launcher/title) via the `update_app` tool. app_id comes from the local `package.json` manifest; the public address (`subdomain`) and code (`deploy`) are unchanged. |
|
|
60
|
-
| `lotics app dev [path] [--port=N] [--vite-port=N] [--view-as=<member_id>]` | Spawn Vite dev server + an RPC-forwarding HTTP server. The wrapper page embeds the iframe with `sandbox="allow-scripts allow-same-origin"` matching production; postMessage ops (query / workflow / members / context / upload / openExternal / urlState / agentRun) are forwarded to api.lotics.ai using the CLI's API key — file bytes move in **both** directions through the dev server's own relays, never browser↔storage: dev runs against the PROD bucket, whose CORS admits `https://*.lotics.app` and not `http://localhost:<port>`, so a direct browser transfer is blocked — no upload could complete and no preview engine (PDF/Word/Excel all FETCH the bytes) could read a file. `upload` mints a presigned URL and PUTs it **to `PUT /_upload/<file_id>`** (`dev/upload_relay.ts`) from the wrapper page — same-origin, so no preflight and no CORS — and Node forwards it on; every presigned `url`/`thumbnail_url`/`preview_url` on a **file object** in an RPC result is rewritten to **`GET /_file/<token>`** (`dev/file_relay.ts`, absolute — the iframe would resolve a relative path against Vite), which streams the bytes back with `Range` passthrough (206s intact, so PDF seeking works) and an `Access-Control-Allow-Origin` for the Vite origin (the one cross-origin hop left is OUR response to allow). Neither relay ever takes a destination from the client — it gets a `file_id`/token and transfers only to/from a URL it minted or observed itself, so there is no client-controlled target and no SSRF surface. A URL in a record's own text cell is NOT rewritten. Production is unchanged (direct-to-storage, no bytes through the API server); `openExternal` and `urlState.get/set` are handled locally (the latter read/write the wrapper page's own address bar — `set` writes in place via `replaceState` and browser back/forward broadcast a `url-state` message back, so `useUrlState` survives refresh and is shareable in the dev loop; in-app *routing* is the app's own (the iframe owns its url via `@lotics/app-sdk/router`), and the wrapper bakes the saved screen (`_loc`) into the iframe src on load so a refresh restores it, mirroring production); `agentRun` (streaming) is proxied through `POST /_agent_run`, which opens the run's SSE with the CLI key and pipes chunks back to the iframe (`stream-chunk`* → `stream-end`), so `useAgentRun` works in the dev loop just like production; `context` resolves the viewer (`member_id` from `cli/whoami` + `comments_enabled` from the local manifest) and fetches the
|
|
60
|
+
| `lotics app dev [path] [--port=N] [--vite-port=N] [--view-as=<member_id>]` | Spawn Vite dev server + an RPC-forwarding HTTP server. The wrapper page embeds the iframe with `sandbox="allow-scripts allow-same-origin"` matching production; postMessage ops (query / workflow / members / context / upload / openExternal / urlState / agentRun) are forwarded to api.lotics.ai using the CLI's API key — file bytes move in **both** directions through the dev server's own relays, never browser↔storage: dev runs against the PROD bucket, whose CORS admits `https://*.lotics.app` and not `http://localhost:<port>`, so a direct browser transfer is blocked — no upload could complete and no preview engine (PDF/Word/Excel all FETCH the bytes) could read a file. `upload` mints a presigned URL and PUTs it **to `PUT /_upload/<file_id>`** (`dev/upload_relay.ts`) from the wrapper page — same-origin, so no preflight and no CORS — and Node forwards it on; every presigned `url`/`thumbnail_url`/`preview_url` on a **file object** in an RPC result is rewritten to **`GET /_file/<token>`** (`dev/file_relay.ts`, absolute — the iframe would resolve a relative path against Vite), which streams the bytes back with `Range` passthrough (206s intact, so PDF seeking works) and an `Access-Control-Allow-Origin` for the Vite origin (the one cross-origin hop left is OUR response to allow). Neither relay ever takes a destination from the client — it gets a `file_id`/token and transfers only to/from a URL it minted or observed itself, so there is no client-controlled target and no SSRF surface. A URL in a record's own text cell is NOT rewritten. Production is unchanged (direct-to-storage, no bytes through the API server); `openExternal` and `urlState.get/set` are handled locally (the latter read/write the wrapper page's own address bar — `set` writes in place via `replaceState` and browser back/forward broadcast a `url-state` message back, so `useUrlState` survives refresh and is shareable in the dev loop; in-app *routing* is the app's own (the iframe owns its url via `@lotics/app-sdk/router`), and the wrapper bakes the saved screen (`_loc`) into the iframe src on load so a refresh restores it, mirroring production); `agentRun` (streaming) is proxied through `POST /_agent_run`, which opens the run's SSE with the CLI key and pipes chunks back to the iframe (`stream-chunk`* → `stream-end`), so `useAgentRun` works in the dev loop just like production; `context` resolves the viewer (`member_id` from `cli/whoami` + `comments_enabled` from the local manifest) and fetches the app's stored `config` live from the app row, so `useConfig()` renders the same values as production. `--view-as` (global flag; also `LOTICS_VIEW_AS`) threads `x-view-as-member-id` so `is_current_member` + `context` resolve to that member — **admin key only** (the server 403s a non-admin), writes stay attributed to the key owner. Hot reload via Vite; full DevTools / Playwright access via plain localhost. **Every forwarded op logs one line naming its ALIAS** — `[rpc] query applicants 231ms` — and `query applicants (count)` for a count request, which is a SECOND full execution of the same query rather than a cheap lookup. When requests overlap the line carries `· N in flight`. That number is the one to watch: the server bounds how many app queries run at once, so requests past the bound wait and the wait lands inside each request's own duration — a burst reads as "every query got slower", which looks like a slow database and is not one. A screen firing its list plus three facet counts on one keystroke shows up here as eight lines over one or two aliases; see `@lotics/app-sdk` `docs/data_fetching.md` (`useCount`, and handing `usePaginatedQuery` a `total`) and `docs/queries.md` §10 for collapsing them. **Holds no realtime connection** — push belongs to the product frontend, so an app previewed here never updates on an external write (a CLI run, another tab, an agent): reload to see it. Deliberate rather than missing, since the alternative is a second implementation of the channel in the wrapper page, and a blanket poll here would hide an app whose queries do not declare their tables — the one mistake the real host punishes. The startup banner says `realtime: off` so this is visible without reading this table. The dev-optimizer pre-bundle list (`optimizeDeps.include`, load-bearing for dev) is imported from `@lotics/ui/vite` (`loticsOptimizeDeps`) rather than hardcoded in the scaffold, so it tracks the installed `@lotics/ui` and can never go stale. Binds **loopback only** (`127.0.0.1`) — `/_rpc` dispatches with the developer's API key, so a socket on every interface would hand anyone on the network full read/write on the workspace. |
|
|
61
61
|
| `LOTICS_UI_SRC=<abs path to packages/ui/src>` (env, not a command) | Dev-link `@lotics/ui` to a monorepo checkout for the length of ONE command, **for every tool at once**. The app's `vite.config.ts` gets its whole `resolve` block from the kit (`resolve: loticsResolve()` — `@lotics/ui/vite`), which reads the variable at call time and adds the `@lotics/ui/*` → working-copy alias, so kit edits go live under `lotics app dev` (HMR) and bundle under `lotics app deploy`. In the same breath, every command that regenerates types (`create`/`pull`/`dev`/`deploy`/`codegen`, all via `writeAppDts`) writes **`.lotics/tsconfig.link.json`** — the matching `paths`, which the app's `tsconfig.json` `extends` — so `tsc`, vitest, eslint and your EDITOR resolve the same copy Vite does. Unset ⇒ every one of them goes back to `node_modules`, and the generated file is rewritten inert. **Why `paths` and not `npm link`:** the kit ships un-built `.tsx`, so a kit file outside `node_modules` resolves its OWN `react`/`react-native` from the monorepo — two copies in one program and every shared type stops matching ("Two different types with this name exist, but they are unrelated"). The generated file therefore also pins every peer @lotics/ui declares to the APP's copy, types-package first (`react` → `@types/react`; pinning the runtime package instead strands tsc on a `.js` with no declarations). The pin set is derived from the installed kit's `peerDependencies`, so it tracks the kit rather than rotting. **Nothing hand-written is touched** — the generated file lives in `.lotics/` (the CLI's own dir) and no config is edited by regex. Identical for a monorepo app and an EXTERNAL one (e.g. `~/lotics_apps`). `app deploy` still warns whenever the variable is set — that the bundle carries kit code from your working copy, or that the app's config predates `loticsResolve()` and never reads it, so the PUBLISHED kit is going out. An app whose `tsconfig.json` already `extends` something else is told rather than rewritten: add `./.lotics/tsconfig.link.json` to the array yourself. |
|
|
62
62
|
| `lotics xlsx <subcmd>` | Local .xlsx read/write/edit using the bundled `@lotics/xlsx` engine (no auth, no network). `write` takes its JSON inline, as `@file`, or piped on stdin, ingested exactly as `run` ingests tool args. 14 named subcommands (read, write, set-cell, clear-range, merge, unmerge, add-sheet, delete-sheet, rename-sheet, insert-rows, delete-rows, insert-cols, delete-cols, set-style) + `batch` for applying multiple of the same 14 ops in a single parse/export cycle. `read` also takes `--sheet <name>` (limit output to one sheet — unknown name fails with the available list) and `--range <sheet>!<A1:G60>` (limit to a cell window; the `<sheet>!` prefix is optional when `--sheet` supplies the sheet, a single cell like `S1!B2` is a 1×1 window) to trim a large workbook's JSON — the output shape is unchanged, only the `sheets` array and each sheet's `cells` map are filtered. **`read` reports formatting back, so a generated file is verifiable through this path** rather than by unzipping OOXML: each cell carries `numFmt` when the file gave it one, and `--with-format` adds the resolved `style`. The asymmetry is deliberate — a parsed cell's style is *never* absent (every cell resolves to at least a font — size, name, colour), so emitting it by default would put three noise keys on every plain cell and make “is this styled?” unanswerable by presence; `numFmt` is genuinely absent on an unformatted cell, so it needs no flag. **`write` takes sheet-level `colWidths` (`{"A":34}`) and `rowHeights` (`{"1":44}`)** — without them every column is the default width and a human-facing workbook is unreadable no matter what the cells say. Both are written *pinned* (`customWidth`/`customHeight`), so Excel does not auto-fit them away, and both apply to a row/column that holds no cells (a spacer row's height survives). Keys are a bare column letter and a bare row number, bounded by Excel's grid (`A`…`XFD`, `1`…`1048576`): a key outside it, or a cell ref like `A1` where a column letter belongs, is **rejected** rather than resolved to something adjacent — past the grid the reference is written into the file verbatim, addressing a cell that cannot exist. Unknown **sheet** properties are rejected on the same terms as unknown cell properties — a silently-ignored `columnWidths` typo is a file that looks written and is not. **A `--flag` a subcommand does not know is refused by name** (`--with-formats` would otherwise read as proof the file carries no styles). `xlsx` and `docx` own their whole tail: a global flag's NAME means nothing there, so `xlsx delete-rows f.xlsx S1 5 3 --force` is refused rather than run, and `xlsx set-cell f.xlsx S1!A1 -v` writes the value `-v`. Subcommands whose trailing arg is CONTENT (`xlsx set-cell`, `docx replace-text`, `docx append-paragraph`/`insert-paragraph`) are deliberately exempt: a value may legitimately begin with `-` or `--`, and there a typo is indistinguishable from data. `--help` is the one spelling still reserved everywhere. They are covered instead by arity — **every fixed-shape subcommand refuses an argument past the last one it reads**, whatever it looks like, because the likeliest source is a flag the caller believes exists and these commands write in place. Arity rather than a leading `--` is the discriminator, since a sheet name may legitimately begin with one. **A cell VALUE is read as the type the caller stated, on both JSON surfaces.** `write`'s `cells` and `batch`'s `set-cell` `value` take the same union — a bare `string | number | boolean | null`, or a `{value, formula, numFmt, style}` object — and honour it: a JSON string writes a text cell, digits and all, so `"0071000512345"` (MST, số tài khoản, số vận đơn) keeps its leading zeros and `"1234567890123456789"` keeps its last two digits, neither of which survives being re-read as characters. The one reading applied to a BARE string is a leading `=`, which is a formula — the only way to write one in the shorthand form; `{"value": "=SUM(A1)"}` is the stated literal, and how a cell that must hold the text `=x` is expressed, on either surface. `value` is a literal on the object form of BOTH surfaces — `formula` is the key that says otherwise — and a literal beginning with `=` is **written as asked and named in a stderr warning**, since it is the one literal indistinguishable from a mistake: it renders in a viewer exactly like the formula the caller probably meant, computes nothing, and is skipped by every SUM over the column. The object form also carries `numFmt` and `style` per cell in `batch`, the same as in `write`. The `set-cell` POSITIONAL is different because a shell argument carries no type: there the characters are read for what they denote (`TRUE` → boolean, digits → number), stopped by two things — the target cell's number format being Text (`@`), and a zero-padded digit string, which stays text whatever the target format says (a deliberate divergence from Excel: losing a leading zero is unrecoverable, while a text cell in a number column is visible). Every subcommand that can introduce a formula (`write`, `set-cell`, `batch`) **evaluates it and writes the cached value**, so a generated formula does not read back blank: Excel and Sheets recalculate on open, but parsers — including this CLI's `read` and the rest of the platform — take the cached `<v>`. A formula the engine cannot evaluate still gets written, with a stderr warning naming the cells, rather than silently leaving a hole where a number belongs. Atomic in-place write (temp file + rename). |
|
|
63
63
|
| `lotics docx <subcmd>` | Local .docx read/write/edit using the bundled `@lotics/docx` engine (OOXML round-trip surface only — no ProseMirror baggage). `write` takes its JSON inline, as `@file`, or piped on stdin, ingested exactly as `run` ingests tool args. Subcommands: read, write, append-paragraph, insert-paragraph, delete-block, replace-text, batch. A legacy `.doc` (Word 97–2003 OLE2 binary) is detected in `loadFile` and routed through `@lotics/ooxml`'s `loadDocxFromBuffer` (which re-emits it as real OOXML) before reading — so `lotics docx read` works on a `.doc`, not just a `.docx`. Opaque blocks (tables, custom XML) preserved verbatim. Atomic in-place write. **`replace-text` matches across run boundaries** — Word splits a run at every formatting change, so a `{{marker}}` routinely lands split — and reads straight THROUGH marks that occupy no place in the sentence (`w:proofErr`, `w:footnoteReference`, endnote/comment refs + ranges, `w:bookmarkStart`/`End`, `w:lastRenderedPageBreak`). `w:proofErr` is the one that decides whether this works in practice — Word brackets every word its dictionary rejects, so on non-English text it lands between nearly every pair of runs. It still refuses to join across anything that occupies space in the text — `w:br`, `w:tab`, `w:sym`, a drawing, or any tag not on that allowlist — because the joined string does not represent the glyph and a match there would rewrite text the caller never saw. The SAME rule applies inside a table cell as outside it — both run one `replaceInParagraph` over paragraphs found at any depth, so a marker split by a line break is refused in both rather than rewritten in the cell and skipped in the body under a success message. Zero matches is always a hard error, never a silent no-op, and when the words ARE on the page the error names the block and the splitting mark (`The text IS present at block 1, split by w:br …`) rather than claiming the text is absent. |
|
package/docs/knowledge_docs.md
CHANGED
|
@@ -221,7 +221,7 @@ statement about discovery, so it cannot silently break an app that depends on a
|
|
|
221
221
|
Reach for it instead of `rm` whenever the material still matters: last year's tariff schedule, a
|
|
222
222
|
handbook a newer one replaced, the raw source a curated doc was written from.
|
|
223
223
|
|
|
224
|
-
##
|
|
224
|
+
## Knowledge from a starter
|
|
225
225
|
|
|
226
226
|
A knowledge doc can also arrive with a **starter** — a published snapshot of a workspace setup
|
|
227
227
|
that carries a corpus of docs (and document templates) along with it. Copying a starter creates
|