@lotics/cli 0.181.1 → 0.182.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 +5 -4
- package/dist/src/cli.js +105 -198
- package/dist/src/client.d.ts +100 -135
- package/dist/src/client.js +47 -65
- package/docs/cli_reference.md +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,18 +39,19 @@ package (reachable at `node_modules/@lotics/cli/docs/*.md` once installed):
|
|
|
39
39
|
## Start from a starter, in one command
|
|
40
40
|
|
|
41
41
|
Install the CLI, then copy a starter — it creates the account, copies the starter into its
|
|
42
|
-
workspace, deploys
|
|
42
|
+
workspace, deploys its apps, and prints a one-time sign-in link:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
curl -fsSL https://lotics.ai/install.sh | bash
|
|
46
46
|
lotics setup <starter_id> --email you@company.com
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
The installer downloads one compiled executable — no Node.js, no npm
|
|
50
|
-
|
|
49
|
+
The installer downloads one compiled executable — no Node.js, no npm, and copying a starter needs
|
|
50
|
+
neither: every app is deployed on Lotics and nothing is written here. Node 18+ comes in only when
|
|
51
|
+
you pull an app's source to change it (`lotics app pull <app_id>`) and build it to deploy again.
|
|
51
52
|
|
|
52
53
|
Add `--json` for one machine-readable object instead of progress — the organization, the
|
|
53
|
-
workspace, the app
|
|
54
|
+
workspace, the app ids, what was created, the sign-in link, and any warnings. Already signed in?
|
|
54
55
|
Drop `--email` and `lotics setup <starter_id>` copies into the account you have.
|
|
55
56
|
|
|
56
57
|
## Install
|
package/dist/src/cli.js
CHANGED
|
@@ -44535,10 +44535,10 @@ var LoticsClient = class {
|
|
|
44535
44535
|
async editPackageListing(package_id, body) {
|
|
44536
44536
|
return this.request("POST", `/v1/packages/${encodeURIComponent(package_id)}/listing`, body);
|
|
44537
44537
|
}
|
|
44538
|
-
// ---
|
|
44539
|
-
// Authoring is server-side: apps via
|
|
44540
|
-
// content
|
|
44541
|
-
// client-side create-package / upload-bundle path.
|
|
44538
|
+
// --- Starters (registry reads + copies) ---
|
|
44539
|
+
// Authoring is server-side: apps via the publish job (`requestStarterPublish`),
|
|
44540
|
+
// content starters via the `publish_content`/`release_content` tools. There is
|
|
44541
|
+
// no client-side create-package / upload-bundle path.
|
|
44542
44542
|
/**
|
|
44543
44543
|
* The starters this organization can copy — Lotics-reviewed ones plus its own,
|
|
44544
44544
|
* never a catalogue of everything published. The server returns exactly what
|
|
@@ -44551,10 +44551,9 @@ var LoticsClient = class {
|
|
|
44551
44551
|
* Copy a starter into the current workspace.
|
|
44552
44552
|
*
|
|
44553
44553
|
* Server-side this scaffolds the schema, creates the templates, docs and
|
|
44554
|
-
* sample records, creates
|
|
44555
|
-
*
|
|
44556
|
-
*
|
|
44557
|
-
* presigned GET of that source, and finishing the job is the caller's half.
|
|
44554
|
+
* sample records, creates every app the starter carries and deploys each
|
|
44555
|
+
* from its prebuilt dist — no build anywhere. `apps` reports each deploy;
|
|
44556
|
+
* one that failed carries its `error` and the copy is complete around it.
|
|
44558
44557
|
* Admin-only.
|
|
44559
44558
|
*/
|
|
44560
44559
|
async instantiateStarter(starter_id, body) {
|
|
@@ -44613,74 +44612,45 @@ var LoticsClient = class {
|
|
|
44613
44612
|
async getWorkspaceDanglingReferences() {
|
|
44614
44613
|
return this.request("GET", "/v1/workspaces/dangling-references");
|
|
44615
44614
|
}
|
|
44615
|
+
// --- Starter publishing (the authoring verbs; copying is `instantiateStarter`) ---
|
|
44616
44616
|
/**
|
|
44617
|
-
* Preview a
|
|
44618
|
-
*
|
|
44619
|
-
*
|
|
44620
|
-
*
|
|
44621
|
-
*
|
|
44622
|
-
*
|
|
44623
|
-
*
|
|
44624
|
-
* owning-org only.
|
|
44617
|
+
* Preview publishing a set of this workspace's apps as one starter version —
|
|
44618
|
+
* the GET behind `opctl starter publish` (no `--yes`). The server runs the
|
|
44619
|
+
* same extraction the publish runs and reports which starter it would
|
|
44620
|
+
* release into (null: it would mint one), the next version, the aliases a
|
|
44621
|
+
* first publish can still rename, the diff against the current version, the
|
|
44622
|
+
* knowledge delta, and the findings (an `error` blocks the publish). No
|
|
44623
|
+
* writes. Admin-only.
|
|
44625
44624
|
*/
|
|
44626
|
-
async
|
|
44625
|
+
async previewStarterPublish(opts) {
|
|
44627
44626
|
const params = new URLSearchParams();
|
|
44628
|
-
|
|
44629
|
-
|
|
44630
|
-
|
|
44631
|
-
|
|
44632
|
-
|
|
44633
|
-
|
|
44634
|
-
|
|
44635
|
-
);
|
|
44627
|
+
params.set("app_ids", opts.app_ids.join(","));
|
|
44628
|
+
if (opts.knowledge_doc_ids !== void 0) params.set("knowledge_doc_ids", opts.knowledge_doc_ids.join(","));
|
|
44629
|
+
if (opts.renames !== void 0 && opts.renames.length > 0) params.set("renames", JSON.stringify(opts.renames));
|
|
44630
|
+
if (opts.name !== void 0) params.set("name", opts.name);
|
|
44631
|
+
if (opts.description !== void 0) params.set("description", opts.description);
|
|
44632
|
+
if (opts.icon !== void 0) params.set("icon", opts.icon);
|
|
44633
|
+
if (opts.color !== void 0) params.set("color", opts.color);
|
|
44634
|
+
return this.request("GET", `/v1/starters/publish-preview?${params.toString()}`);
|
|
44636
44635
|
}
|
|
44637
44636
|
/**
|
|
44638
|
-
*
|
|
44639
|
-
*
|
|
44640
|
-
*
|
|
44641
|
-
*
|
|
44642
|
-
*
|
|
44643
|
-
* the
|
|
44644
|
-
* missing/archived declared doc is a 400, a foreign-package doc a 409. Admin,
|
|
44645
|
-
* owning-org only. Backs `opctl app release --yes`.
|
|
44637
|
+
* Publish this workspace's apps as a starter version — a JOB, because every
|
|
44638
|
+
* app is built once against sentinel field keys and eleven builds outlast a
|
|
44639
|
+
* request. Everything a request can refuse is refused here with nothing
|
|
44640
|
+
* written: a blocking finding or another publish still running for this
|
|
44641
|
+
* org (409), a missing deploy or a bad declaration (400). The response is
|
|
44642
|
+
* the job to poll with `getStarterPublish`. Admin-only.
|
|
44646
44643
|
*/
|
|
44647
|
-
async
|
|
44648
|
-
|
|
44649
|
-
|
|
44650
|
-
|
|
44651
|
-
|
|
44652
|
-
|
|
44653
|
-
* server runs the same fresh-alias extract + `src/` scan the apply runs
|
|
44654
|
-
* (through any `renames`) and returns the package name it would mint, the
|
|
44655
|
-
* auto-minted RENAMABLE aliases (the exact `--rename` keys), and the extract
|
|
44656
|
-
* findings (an `error` blocks the apply). No writes. Admin-only.
|
|
44657
|
-
*/
|
|
44658
|
-
async previewPublishAppPackage(app_id, opts = {}) {
|
|
44659
|
-
const params = new URLSearchParams();
|
|
44660
|
-
if (opts.knowledge !== void 0 && opts.knowledge.length > 0) {
|
|
44661
|
-
params.set("knowledge", JSON.stringify(opts.knowledge));
|
|
44662
|
-
}
|
|
44663
|
-
if (opts.renames !== void 0 && opts.renames.length > 0) {
|
|
44664
|
-
params.set("renames", JSON.stringify(opts.renames));
|
|
44665
|
-
}
|
|
44666
|
-
const query = params.toString();
|
|
44667
|
-
return this.request(
|
|
44668
|
-
"GET",
|
|
44669
|
-
`/v1/apps/${encodeURIComponent(app_id)}/package-publish${query ? `?${query}` : ""}`
|
|
44670
|
-
);
|
|
44644
|
+
async requestStarterPublish(body) {
|
|
44645
|
+
const { color, ...rest2 } = body;
|
|
44646
|
+
return this.request("POST", "/v1/starters/publishes", {
|
|
44647
|
+
...rest2,
|
|
44648
|
+
...color !== void 0 ? { theme: { color } } : {}
|
|
44649
|
+
});
|
|
44671
44650
|
}
|
|
44672
|
-
/**
|
|
44673
|
-
|
|
44674
|
-
|
|
44675
|
-
* alias-keyed contract from the app (fresh aliases; `renames` fixes them before
|
|
44676
|
-
* v1 freezes), creates the registry package (name/description from the app),
|
|
44677
|
-
* publishes v1 from the app's deployed source + dist, and pins the origin as
|
|
44678
|
-
* installation #1. Error findings from extract surface as a 409. An
|
|
44679
|
-
* already-linked app must use `releasePackage` instead. Admin-only. Backs
|
|
44680
|
-
* `opctl app publish <app_id>`.
|
|
44681
|
-
*/
|
|
44682
|
-
async publishAppAsPackage(app_id, body) {
|
|
44683
|
-
return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-publish`, body);
|
|
44651
|
+
/** The state of a publish: which app is building, and the version once every dist is in. */
|
|
44652
|
+
async getStarterPublish(publish_id) {
|
|
44653
|
+
return this.request("GET", `/v1/starters/publishes/${encodeURIComponent(publish_id)}`);
|
|
44684
44654
|
}
|
|
44685
44655
|
/**
|
|
44686
44656
|
* Resolve the display name + fields (incl. select options) of the given tables
|
|
@@ -45711,7 +45681,7 @@ function resultSideEffects(result) {
|
|
|
45711
45681
|
}
|
|
45712
45682
|
|
|
45713
45683
|
// src/version.ts
|
|
45714
|
-
var VERSION = "0.
|
|
45684
|
+
var VERSION = "0.182.0";
|
|
45715
45685
|
|
|
45716
45686
|
// src/timezone.ts
|
|
45717
45687
|
function machineTimezone() {
|
|
@@ -45881,11 +45851,11 @@ var COMMANDS = [
|
|
|
45881
45851
|
{
|
|
45882
45852
|
verbs: ["setup"],
|
|
45883
45853
|
help: [
|
|
45884
|
-
" lotics setup <starter_id>
|
|
45854
|
+
" lotics setup <starter_id> --email <you@co.com>",
|
|
45885
45855
|
" First run, one command: create an account if this",
|
|
45886
45856
|
" machine has none, then copy the starter into its",
|
|
45887
45857
|
" workspace \u2014 schema, templates, knowledge docs,",
|
|
45888
|
-
" sample records,
|
|
45858
|
+
" sample records, its apps deployed \u2014 and print a",
|
|
45889
45859
|
" one-time sign-in link. Drop --email to copy into",
|
|
45890
45860
|
" the account you already have. --json prints one",
|
|
45891
45861
|
" object and nothing else"
|
|
@@ -45923,12 +45893,11 @@ var COMMANDS = [
|
|
|
45923
45893
|
" NO account \u2014 it then lists the published shelf, so you",
|
|
45924
45894
|
" can decide whether to copy one or build before signing up",
|
|
45925
45895
|
" lotics starter show <starter_id> What one carries: tables, docs, templates, sample data",
|
|
45926
|
-
" lotics starter init <starter_id>
|
|
45927
|
-
"
|
|
45928
|
-
"
|
|
45929
|
-
"
|
|
45930
|
-
"
|
|
45931
|
-
" locally, so it needs node + a few minutes.",
|
|
45896
|
+
" lotics starter init <starter_id> Copy it in \u2014 schema, templates, knowledge docs,",
|
|
45897
|
+
" sample records and its apps, deployed on Lotics. A",
|
|
45898
|
+
" COPY: everything it creates is yours outright, with",
|
|
45899
|
+
" no link back and nothing to upgrade. Nothing lands",
|
|
45900
|
+
" on this machine; lotics app pull <app_id> edits one.",
|
|
45932
45901
|
" --no-sample-data skips the sample records;",
|
|
45933
45902
|
" --adopt allows a workspace that is not empty",
|
|
45934
45903
|
" lotics starter fixtures capture --entity <alias> --limit <n>",
|
|
@@ -74054,7 +74023,6 @@ function parseArgs(argv) {
|
|
|
74054
74023
|
// src/starter_commands.ts
|
|
74055
74024
|
import fs9 from "node:fs";
|
|
74056
74025
|
import path10 from "node:path";
|
|
74057
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
74058
74026
|
function printStarterRows(rows) {
|
|
74059
74027
|
const width = Math.max(...rows.map((row) => row.id.length));
|
|
74060
74028
|
for (const row of rows) {
|
|
@@ -74160,121 +74128,74 @@ function instantiateBody(args) {
|
|
|
74160
74128
|
}
|
|
74161
74129
|
async function starterInit(client, args) {
|
|
74162
74130
|
const starter = await client.getPackage(args.starter_id);
|
|
74163
|
-
const targetPath = path10.resolve(args.targetPath ?? appDirName(starter.name));
|
|
74164
|
-
if (fs9.existsSync(targetPath) && fs9.readdirSync(targetPath).length > 0) {
|
|
74165
|
-
throw new Error(`Target directory ${targetPath} is not empty. Pass an empty path and re-run.`);
|
|
74166
|
-
}
|
|
74167
74131
|
note(
|
|
74168
74132
|
`Copying ${starter.name}${starter.is_official ? " (official)" : ""} into this workspace\u2026`
|
|
74169
74133
|
);
|
|
74170
74134
|
const result = await client.instantiateStarter(args.starter_id, instantiateBody(args));
|
|
74135
|
+
if (!Array.isArray(result.apps)) {
|
|
74136
|
+
throw new Error(
|
|
74137
|
+
`This Lotics server predates this CLI and reported nothing about the copy's apps.
|
|
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
|
+
}
|
|
74171
74142
|
const tables = Object.keys(result.binding.entities ?? {}).sort();
|
|
74172
74143
|
const knowledgeDocs = Object.keys(result.binding.knowledge ?? {}).sort();
|
|
74173
74144
|
const templates = Object.keys(result.binding.templates ?? {}).sort();
|
|
74174
74145
|
const records = Object.values(result.sample_record_ids).reduce((n, ids) => n + ids.length, 0);
|
|
74175
|
-
const created = {
|
|
74176
|
-
|
|
74177
|
-
|
|
74178
|
-
|
|
74179
|
-
|
|
74180
|
-
|
|
74146
|
+
const created = { tables, templates, knowledge_docs: knowledgeDocs, sample_records: records };
|
|
74147
|
+
const apps = result.apps.map((app) => ({
|
|
74148
|
+
alias: app.alias,
|
|
74149
|
+
app_id: app.app_id,
|
|
74150
|
+
name: app.name,
|
|
74151
|
+
version_number: app.deployed?.version_number ?? null,
|
|
74152
|
+
error: app.error
|
|
74153
|
+
}));
|
|
74181
74154
|
note(
|
|
74182
|
-
` 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"}.`
|
|
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"}${apps.length > 0 ? `, ${apps.length} app${apps.length === 1 ? "" : "s"}` : ""}.`
|
|
74183
74156
|
);
|
|
74184
74157
|
reportKnowledgeWarnings(result.knowledge_warnings);
|
|
74185
|
-
|
|
74158
|
+
const base = {
|
|
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) {
|
|
74186
74167
|
note(`
|
|
74187
74168
|
Done \u2014 these are yours now, with no link back to the starter.`);
|
|
74188
74169
|
noteCopiedContent(templates, knowledgeDocs);
|
|
74189
|
-
return {
|
|
74190
|
-
starter_id: args.starter_id,
|
|
74191
|
-
starter_name: starter.name,
|
|
74192
|
-
version: result.version,
|
|
74193
|
-
app_id: null,
|
|
74194
|
-
project_dir: null,
|
|
74195
|
-
created,
|
|
74196
|
-
signin_url: null
|
|
74197
|
-
};
|
|
74198
|
-
}
|
|
74199
|
-
fs9.mkdirSync(targetPath, { recursive: true });
|
|
74200
|
-
note(`Downloading source\u2026`);
|
|
74201
|
-
const bundleFile = path10.join(tmpdir2(), `lotics-starter-${args.starter_id}-${process.pid}.tar.gz`);
|
|
74202
|
-
const wrapperDir = fs9.mkdtempSync(path10.join(tmpdir2(), `lotics-starter-`));
|
|
74203
|
-
try {
|
|
74204
|
-
await downloadToFile(result.bundle_url, bundleFile);
|
|
74205
|
-
await runTar(["-xzf", bundleFile, "-C", wrapperDir], wrapperDir);
|
|
74206
|
-
const sourceArchive = path10.join(wrapperDir, "source.tar.gz");
|
|
74207
|
-
if (!fs9.existsSync(sourceArchive)) {
|
|
74208
|
-
throw new Error(
|
|
74209
|
-
`Starter bundle carried no source.tar.gz \u2014 the app (${result.app_id}) exists but has no code. Report this to the starter's publisher.`
|
|
74210
|
-
);
|
|
74211
|
-
}
|
|
74212
|
-
await runTar(["-xzf", sourceArchive, "-C", targetPath], targetPath);
|
|
74213
|
-
} finally {
|
|
74214
|
-
if (fs9.existsSync(bundleFile)) fs9.unlinkSync(bundleFile);
|
|
74215
|
-
fs9.rmSync(wrapperDir, { recursive: true, force: true });
|
|
74216
|
-
}
|
|
74217
|
-
for (const dir of ["knowledge", "fixtures"]) {
|
|
74218
|
-
fs9.rmSync(path10.join(targetPath, dir), { recursive: true, force: true });
|
|
74170
|
+
return { ...base, signin_url: null };
|
|
74219
74171
|
}
|
|
74220
|
-
const app = await client.getApp(result.app_id);
|
|
74221
|
-
const kept = [];
|
|
74222
|
-
await hydrateAppProject(client, targetPath, app, {
|
|
74223
|
-
// Nothing is deployed yet; the build below is what mints v1.
|
|
74224
|
-
stamp: { id: null, number: null },
|
|
74225
|
-
kept
|
|
74226
|
-
});
|
|
74227
|
-
const serverDeployed = result.deployed ?? null;
|
|
74228
74172
|
if (starter.owned_by_caller !== true) {
|
|
74229
74173
|
warn(
|
|
74230
|
-
|
|
74231
|
-
|
|
74232
|
-
|
|
74233
|
-
Building ${starter.name} \u2014 this runs its build on your machine (its package scripts
|
|
74234
|
-
and vite config are the publisher's code, executed as you).${starter.is_official ? " Lotics reviewed this starter." : ""}`
|
|
74174
|
+
`
|
|
74175
|
+
${starter.name} is the publisher's code \u2014 its apps, workflows and agents \u2014 and runs in
|
|
74176
|
+
this workspace as you.${starter.is_official ? " Lotics reviewed this starter." : ""}`
|
|
74235
74177
|
);
|
|
74236
|
-
} else if (serverDeployed === null) {
|
|
74237
|
-
note(`Building and deploying\u2026`);
|
|
74238
74178
|
}
|
|
74239
|
-
|
|
74240
|
-
|
|
74241
|
-
`
|
|
74242
|
-
Lotics could not build ${starter.name} \u2014 building here instead.
|
|
74243
|
-
${result.build_error.split("\n")[0]}
|
|
74244
|
-
The copy is fine: the tables, the records and the app all landed. Do NOT
|
|
74245
|
-
copy again, and do not write a replacement app \u2014 only the build is missing.`
|
|
74179
|
+
for (const app of apps) {
|
|
74180
|
+
note(
|
|
74181
|
+
app.error === null ? ` \u2713 ${app.name} (${app.app_id}, v${app.version_number})` : ` \u2717 ${app.name} (${app.app_id}): ${app.error.split("\n")[0]}`
|
|
74246
74182
|
);
|
|
74247
74183
|
}
|
|
74248
|
-
const
|
|
74249
|
-
|
|
74250
|
-
|
|
74251
|
-
|
|
74252
|
-
|
|
74253
|
-
|
|
74254
|
-
|
|
74255
|
-
projectDir: targetPath,
|
|
74256
|
-
message: `Copied from starter ${starter.name}`
|
|
74257
|
-
});
|
|
74258
|
-
}
|
|
74259
|
-
} catch (error52) {
|
|
74260
|
-
const reason = error52 instanceof Error ? error52.message : String(error52);
|
|
74261
|
-
throw new Error(
|
|
74262
|
-
`${reason}
|
|
74263
|
-
|
|
74264
|
-
The copy itself is DONE and nothing needs repeating: the tables, the sample
|
|
74265
|
-
records and the project all landed. Only the deploy is left.
|
|
74266
|
-
|
|
74267
|
-
Finish it: cd ${resumeDir} && lotics app deploy -m "Copied from starter ${starter.name}"
|
|
74268
|
-
|
|
74269
|
-
Do NOT re-run the copy \u2014 it would adopt the tables this one just created and
|
|
74270
|
-
insert the sample records again.`
|
|
74184
|
+
const failed = apps.filter((app) => app.error !== null);
|
|
74185
|
+
if (failed.length > 0) {
|
|
74186
|
+
warn(
|
|
74187
|
+
`
|
|
74188
|
+
${failed.length} app${failed.length === 1 ? "" : "s"} landed without a version: ${failed.map((app) => app.name).join(", ")}.
|
|
74189
|
+
The copy is otherwise complete \u2014 do NOT copy again, and do not write a replacement
|
|
74190
|
+
app. Report this to the starter's publisher; a fixed starter is copied into a fresh workspace.`
|
|
74271
74191
|
);
|
|
74192
|
+
process.exitCode = 1;
|
|
74272
74193
|
}
|
|
74273
74194
|
let signInUrl = null;
|
|
74274
74195
|
try {
|
|
74275
74196
|
const link = await client.login({
|
|
74276
74197
|
return_link: true,
|
|
74277
|
-
redirect_path: `/apps/${
|
|
74198
|
+
redirect_path: apps.length === 1 ? `/apps/${apps[0].app_id}` : "/apps"
|
|
74278
74199
|
});
|
|
74279
74200
|
signInUrl = link.url ?? null;
|
|
74280
74201
|
} catch (error52) {
|
|
@@ -74288,15 +74209,11 @@ insert the sample records again.`
|
|
|
74288
74209
|
note(
|
|
74289
74210
|
`
|
|
74290
74211
|
Done \u2014 ${starter.name} is live and yours.
|
|
74291
|
-
App: ${result.app_id}
|
|
74292
|
-
Project: ${targetPath}
|
|
74293
|
-
|
|
74294
|
-
Edit anything: the tables, the app source, the templates, the docs. There is no
|
|
74295
|
-
link back to the starter and nothing to upgrade \u2014 this is your app now.
|
|
74296
|
-
Ship a change: cd ${path10.relative(process.cwd(), targetPath) || "."} && lotics app deploy -m "<what changed>"
|
|
74297
74212
|
|
|
74298
|
-
|
|
74299
|
-
the
|
|
74213
|
+
Edit anything: the tables, the apps, the templates, the docs. There is no link
|
|
74214
|
+
back to the starter and nothing to upgrade \u2014 this is your workspace now.
|
|
74215
|
+
Change an app's code: lotics app pull <app_id> (then lotics app deploy -m "<what changed>")
|
|
74216
|
+
How to change it: lotics docs building_an_app (then \`lotics docs\` for the rest)`
|
|
74300
74217
|
);
|
|
74301
74218
|
if (records > 0) {
|
|
74302
74219
|
note(
|
|
@@ -74307,21 +74224,11 @@ Done \u2014 ${starter.name} is live and yours.
|
|
|
74307
74224
|
}
|
|
74308
74225
|
noteCopiedContent(templates, knowledgeDocs);
|
|
74309
74226
|
if (signInUrl !== null) {
|
|
74310
|
-
note(
|
|
74311
|
-
`
|
|
74227
|
+
note(`
|
|
74312
74228
|
Open it \u2014 one-time sign-in link, expires in 15 minutes:
|
|
74313
|
-
${signInUrl}`
|
|
74314
|
-
);
|
|
74229
|
+
${signInUrl}`);
|
|
74315
74230
|
}
|
|
74316
|
-
return {
|
|
74317
|
-
starter_id: args.starter_id,
|
|
74318
|
-
starter_name: starter.name,
|
|
74319
|
-
version: result.version,
|
|
74320
|
-
app_id: result.app_id,
|
|
74321
|
-
project_dir: targetPath,
|
|
74322
|
-
created,
|
|
74323
|
-
signin_url: signInUrl
|
|
74324
|
-
};
|
|
74231
|
+
return { ...base, signin_url: signInUrl };
|
|
74325
74232
|
}
|
|
74326
74233
|
async function starterFixturesCapture(client, args) {
|
|
74327
74234
|
const projectDir = path10.resolve(args.projectDir ?? process.cwd());
|
|
@@ -103064,7 +102971,7 @@ async function runKnowledgeCommand(client, subcommand, toolArgs, flags, restArgs
|
|
|
103064
102971
|
import { spawn as spawn3 } from "node:child_process";
|
|
103065
102972
|
import { createServer } from "node:http";
|
|
103066
102973
|
import { readFileSync, writeFileSync, existsSync as existsSync2, mkdtempSync, rmSync, readdirSync } from "node:fs";
|
|
103067
|
-
import { tmpdir as
|
|
102974
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
103068
102975
|
import { join as join2, dirname, resolve, extname, basename } from "node:path";
|
|
103069
102976
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
103070
102977
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -103163,7 +103070,7 @@ async function runPreviewCommand(filePath, flags) {
|
|
|
103163
103070
|
});
|
|
103164
103071
|
await new Promise((r) => server.listen(0, "127.0.0.1", () => r()));
|
|
103165
103072
|
const httpPort = server.address().port;
|
|
103166
|
-
const udd = mkdtempSync(join2(
|
|
103073
|
+
const udd = mkdtempSync(join2(tmpdir2(), "lotics-render-"));
|
|
103167
103074
|
const child = spawn3(chrome, [
|
|
103168
103075
|
"--headless=new",
|
|
103169
103076
|
"--disable-gpu",
|
|
@@ -103686,10 +103593,10 @@ async function main() {
|
|
|
103686
103593
|
if (command === "setup") {
|
|
103687
103594
|
const starterId = subcommand;
|
|
103688
103595
|
if (!starterId) {
|
|
103689
|
-
console.error("Usage: lotics setup <starter_id> [
|
|
103596
|
+
console.error("Usage: lotics setup <starter_id> [--email <you@co.com>] [--json]");
|
|
103690
103597
|
console.error(" Creates an account if this machine has none, then copies the starter");
|
|
103691
103598
|
console.error(" into its workspace: schema, templates, knowledge docs, sample records");
|
|
103692
|
-
console.error(" and
|
|
103599
|
+
console.error(" and its apps, deployed. Ends with a one-time sign-in link.");
|
|
103693
103600
|
console.error(" --json prints one object and nothing else.");
|
|
103694
103601
|
process.exit(1);
|
|
103695
103602
|
}
|
|
@@ -103725,9 +103632,9 @@ async function main() {
|
|
|
103725
103632
|
}
|
|
103726
103633
|
const { client: client2, ctx: ctx2 } = requireClient(flags);
|
|
103727
103634
|
await resolveWorkspace(client2, ctx2);
|
|
103635
|
+
if (toolArgs !== void 0) warn(`A path is no longer needed \u2014 a copy writes nothing to disk. Ignoring "${toolArgs}".`);
|
|
103728
103636
|
const result = await starterInit(client2, {
|
|
103729
103637
|
starter_id: starterId,
|
|
103730
|
-
...toolArgs !== void 0 ? { targetPath: toolArgs } : {},
|
|
103731
103638
|
...flags.noSampleData === true ? { noSampleData: true } : {},
|
|
103732
103639
|
...flags.adopt === true ? { adopt: true } : {}
|
|
103733
103640
|
});
|
|
@@ -103759,18 +103666,18 @@ async function main() {
|
|
|
103759
103666
|
}
|
|
103760
103667
|
if (subcommand === "init") {
|
|
103761
103668
|
if (!toolArgs) {
|
|
103762
|
-
console.error("Usage: lotics starter init <starter_id> [
|
|
103669
|
+
console.error("Usage: lotics starter init <starter_id> [--no-sample-data] [--adopt]");
|
|
103763
103670
|
console.error(" Copies a starter into this workspace: schema, templates, knowledge");
|
|
103764
|
-
console.error(" docs, sample records and
|
|
103765
|
-
console.error("
|
|
103671
|
+
console.error(" docs, sample records and its apps, deployed on Lotics. Nothing is");
|
|
103672
|
+
console.error(" written here; edit an app afterwards with lotics app pull <app_id>.");
|
|
103766
103673
|
process.exit(1);
|
|
103767
103674
|
}
|
|
103768
103675
|
if (flags.json) setMachineOutput(true);
|
|
103769
103676
|
const { client: client2, ctx: ctx2 } = requireClient(flags);
|
|
103770
103677
|
await resolveWorkspace(client2, ctx2);
|
|
103678
|
+
if (restArgs[0] !== void 0) warn(`A path is no longer needed \u2014 a copy writes nothing to disk. Ignoring "${restArgs[0]}".`);
|
|
103771
103679
|
const result = await starterInit(client2, {
|
|
103772
103680
|
starter_id: toolArgs,
|
|
103773
|
-
...restArgs[0] !== void 0 ? { targetPath: restArgs[0] } : {},
|
|
103774
103681
|
...flags.noSampleData === true ? { noSampleData: true } : {},
|
|
103775
103682
|
...flags.adopt === true ? { adopt: true } : {}
|
|
103776
103683
|
});
|
|
@@ -103804,7 +103711,7 @@ async function main() {
|
|
|
103804
103711
|
return;
|
|
103805
103712
|
}
|
|
103806
103713
|
console.error(
|
|
103807
|
-
"Usage: lotics starter list | show <starter_id> | init <starter_id>
|
|
103714
|
+
"Usage: lotics starter list | show <starter_id> | init <starter_id> | fixtures capture"
|
|
103808
103715
|
);
|
|
103809
103716
|
process.exit(1);
|
|
103810
103717
|
}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -120,6 +120,68 @@ export interface ExtractFinding {
|
|
|
120
120
|
area: string;
|
|
121
121
|
message: string;
|
|
122
122
|
}
|
|
123
|
+
export interface StarterPublishRequest {
|
|
124
|
+
/** The origin apps that ship, in alias-minting order. */
|
|
125
|
+
app_ids: string[];
|
|
126
|
+
/** Live knowledge doc ids to bundle. Omitted keeps the previous version's set; [] drops them all. */
|
|
127
|
+
knowledge_doc_ids?: string[];
|
|
128
|
+
/** First publish only: alias fixes before v1 freezes them. */
|
|
129
|
+
renames?: Array<{
|
|
130
|
+
from: string;
|
|
131
|
+
to: string;
|
|
132
|
+
}>;
|
|
133
|
+
/** First publish only: the listing name; defaults to the workspace's. */
|
|
134
|
+
name?: string;
|
|
135
|
+
/** First publish only: the listing description; defaults to the first app's. */
|
|
136
|
+
description?: string;
|
|
137
|
+
/** First publish only: the listing icon; defaults to the first app's. */
|
|
138
|
+
icon?: string;
|
|
139
|
+
/** First publish only: the listing accent colour; defaults to the first app's. */
|
|
140
|
+
color?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface StarterPublishPreview {
|
|
143
|
+
/** The starter this would release into, or null when it would mint one. */
|
|
144
|
+
starter_id: string | null;
|
|
145
|
+
starter_name: string;
|
|
146
|
+
version: number;
|
|
147
|
+
apps: Array<{
|
|
148
|
+
alias: string;
|
|
149
|
+
app_id: string;
|
|
150
|
+
name: string;
|
|
151
|
+
}>;
|
|
152
|
+
/** Empty on a release — its aliases froze at v1. */
|
|
153
|
+
renamable_aliases: {
|
|
154
|
+
entities: string[];
|
|
155
|
+
fields: string[];
|
|
156
|
+
options: string[];
|
|
157
|
+
roles: string[];
|
|
158
|
+
templates: string[];
|
|
159
|
+
};
|
|
160
|
+
added_aliases: string[];
|
|
161
|
+
changed_artifacts: string[];
|
|
162
|
+
knowledge: {
|
|
163
|
+
added: string[];
|
|
164
|
+
removed: string[];
|
|
165
|
+
changed: string[];
|
|
166
|
+
};
|
|
167
|
+
findings: ExtractFinding[];
|
|
168
|
+
}
|
|
169
|
+
/** A publish is a job; this is the row the requester polls. */
|
|
170
|
+
export interface StarterPublish {
|
|
171
|
+
id: string;
|
|
172
|
+
status: "pending" | "building" | "completed" | "failed";
|
|
173
|
+
/** Null until a first publish completes. */
|
|
174
|
+
starter_id: string | null;
|
|
175
|
+
version_id: string | null;
|
|
176
|
+
version: number | null;
|
|
177
|
+
app_ids: string[];
|
|
178
|
+
building_app_alias: string | null;
|
|
179
|
+
apps_built: number;
|
|
180
|
+
error: string | null;
|
|
181
|
+
created_at: string;
|
|
182
|
+
started_at: string | null;
|
|
183
|
+
finished_at: string | null;
|
|
184
|
+
}
|
|
123
185
|
/** Advisory knowledge warnings surfaced by install/upgrade (never block). */
|
|
124
186
|
export interface KnowledgeWarnings {
|
|
125
187
|
/** `knowledge_expects` doc names with no matching workspace doc. */
|
|
@@ -398,40 +460,35 @@ export declare class LoticsClient {
|
|
|
398
460
|
* Copy a starter into the current workspace.
|
|
399
461
|
*
|
|
400
462
|
* Server-side this scaffolds the schema, creates the templates, docs and
|
|
401
|
-
* sample records, creates
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* presigned GET of that source, and finishing the job is the caller's half.
|
|
463
|
+
* sample records, creates every app the starter carries and deploys each
|
|
464
|
+
* from its prebuilt dist — no build anywhere. `apps` reports each deploy;
|
|
465
|
+
* one that failed carries its `error` and the copy is complete around it.
|
|
405
466
|
* Admin-only.
|
|
406
467
|
*/
|
|
407
468
|
instantiateStarter(starter_id: string, body: {
|
|
408
469
|
version?: number;
|
|
409
470
|
no_sample_data?: boolean;
|
|
410
471
|
adopt?: boolean;
|
|
411
|
-
/**
|
|
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
|
+
*/
|
|
412
477
|
build_on_server?: boolean;
|
|
413
478
|
}): Promise<{
|
|
414
|
-
|
|
479
|
+
/** Each app's deploy, in contract order. `error` set and `deployed` null when one did not land. */
|
|
480
|
+
apps: Array<{
|
|
481
|
+
alias: string;
|
|
482
|
+
app_id: string;
|
|
483
|
+
name: string;
|
|
484
|
+
deployed: {
|
|
485
|
+
version_id: string;
|
|
486
|
+
version_number: number;
|
|
487
|
+
} | null;
|
|
488
|
+
error: string | null;
|
|
489
|
+
}>;
|
|
415
490
|
starter_id: string;
|
|
416
491
|
version: number;
|
|
417
|
-
bundle_url: string | null;
|
|
418
|
-
/**
|
|
419
|
-
* The version the SERVER deployed, when it did.
|
|
420
|
-
*
|
|
421
|
-
* Optional in this type on purpose: a server that predates the field omits
|
|
422
|
-
* it entirely, and it is absent rather than null. Callers must treat "not
|
|
423
|
-
* there" and "null" alike and build locally — assuming the request was
|
|
424
|
-
* honoured would report success over an app nobody built.
|
|
425
|
-
*/
|
|
426
|
-
deployed?: {
|
|
427
|
-
version_id: string;
|
|
428
|
-
version_number: number;
|
|
429
|
-
} | null;
|
|
430
|
-
/**
|
|
431
|
-
* Why the server built nothing, when it was asked to and `deployed` is null.
|
|
432
|
-
* Absent from an older server's response for the same reason as `deployed`.
|
|
433
|
-
*/
|
|
434
|
-
build_error?: string | null;
|
|
435
492
|
binding: Record<string, Record<string, string>>;
|
|
436
493
|
sample_record_ids: Record<string, string[]>;
|
|
437
494
|
knowledge_warnings: {
|
|
@@ -525,120 +582,28 @@ export declare class LoticsClient {
|
|
|
525
582
|
};
|
|
526
583
|
}>>;
|
|
527
584
|
/**
|
|
528
|
-
* Preview a
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
previewPackageRelease(app_id: string, opts?: {
|
|
538
|
-
/** alias → doc_id re-declaring the bundled-knowledge set (from the manifest). */
|
|
539
|
-
knowledge?: Array<{
|
|
540
|
-
alias: string;
|
|
541
|
-
doc_id: string;
|
|
542
|
-
}>;
|
|
543
|
-
}): Promise<{
|
|
544
|
-
package_id: string;
|
|
545
|
-
version: number;
|
|
546
|
-
added_aliases: string[];
|
|
547
|
-
changed_artifacts: string[];
|
|
548
|
-
/** Absent from a pre-declaration server (deploy skew) — treat as empty delta. */
|
|
549
|
-
knowledge?: {
|
|
550
|
-
added: string[];
|
|
551
|
-
removed: string[];
|
|
552
|
-
changed: string[];
|
|
553
|
-
};
|
|
554
|
-
findings: ExtractFinding[];
|
|
555
|
-
}>;
|
|
556
|
-
/**
|
|
557
|
-
* Release — snapshot the origin app into the next registry version. The server
|
|
558
|
-
* binding-aware-extracts it, repackages its deployed source + dist as the
|
|
559
|
-
* bundle, publishes the next `release`-channel version with the changelog, and
|
|
560
|
-
* re-pins the origin. An optional `knowledge` declaration re-declares the
|
|
561
|
-
* bundled-knowledge set (added/dropped/re-snapshotted docs; omitted preserves
|
|
562
|
-
* the current corpus). Error findings from extract surface as a 409; a
|
|
563
|
-
* missing/archived declared doc is a 400, a foreign-package doc a 409. Admin,
|
|
564
|
-
* owning-org only. Backs `opctl app release --yes`.
|
|
565
|
-
*/
|
|
566
|
-
releasePackage(app_id: string, body: {
|
|
567
|
-
changelog: string;
|
|
568
|
-
/** alias → doc_id re-declaring the bundled-knowledge set (from the manifest). */
|
|
569
|
-
knowledge?: Array<{
|
|
570
|
-
alias: string;
|
|
571
|
-
doc_id: string;
|
|
572
|
-
}>;
|
|
573
|
-
}): Promise<{
|
|
574
|
-
package_id: string;
|
|
575
|
-
version: number;
|
|
576
|
-
added_aliases: string[];
|
|
577
|
-
changed_artifacts: string[];
|
|
578
|
-
/** Absent from a pre-declaration server (deploy skew) — treat as empty delta. */
|
|
579
|
-
knowledge?: {
|
|
580
|
-
added: string[];
|
|
581
|
-
removed: string[];
|
|
582
|
-
changed: string[];
|
|
583
|
-
};
|
|
584
|
-
}>;
|
|
585
|
+
* Preview publishing a set of this workspace's apps as one starter version —
|
|
586
|
+
* the GET behind `opctl starter publish` (no `--yes`). The server runs the
|
|
587
|
+
* same extraction the publish runs and reports which starter it would
|
|
588
|
+
* release into (null: it would mint one), the next version, the aliases a
|
|
589
|
+
* first publish can still rename, the diff against the current version, the
|
|
590
|
+
* knowledge delta, and the findings (an `error` blocks the publish). No
|
|
591
|
+
* writes. Admin-only.
|
|
592
|
+
*/
|
|
593
|
+
previewStarterPublish(opts: StarterPublishRequest): Promise<StarterPublishPreview>;
|
|
585
594
|
/**
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
595
|
+
* Publish this workspace's apps as a starter version — a JOB, because every
|
|
596
|
+
* app is built once against sentinel field keys and eleven builds outlast a
|
|
597
|
+
* request. Everything a request can refuse is refused here with nothing
|
|
598
|
+
* written: a blocking finding or another publish still running for this
|
|
599
|
+
* org (409), a missing deploy or a bad declaration (400). The response is
|
|
600
|
+
* the job to poll with `getStarterPublish`. Admin-only.
|
|
592
601
|
*/
|
|
593
|
-
|
|
594
|
-
renames?: Array<{
|
|
595
|
-
from: string;
|
|
596
|
-
to: string;
|
|
597
|
-
}>;
|
|
598
|
-
/** alias → doc_id for the app's package-managed knowledge (from its manifest). */
|
|
599
|
-
knowledge?: Array<{
|
|
600
|
-
alias: string;
|
|
601
|
-
doc_id: string;
|
|
602
|
-
}>;
|
|
603
|
-
}): Promise<{
|
|
604
|
-
app_id: string;
|
|
605
|
-
package_name: string;
|
|
606
|
-
renamable_aliases: {
|
|
607
|
-
entities: string[];
|
|
608
|
-
fields: string[];
|
|
609
|
-
options: string[];
|
|
610
|
-
roles: string[];
|
|
611
|
-
templates: string[];
|
|
612
|
-
workflows: string[];
|
|
613
|
-
};
|
|
614
|
-
findings: ExtractFinding[];
|
|
615
|
-
}>;
|
|
616
|
-
/**
|
|
617
|
-
* First-release apply — mint a package from a BESPOKE app and publish v1 in one
|
|
618
|
-
* call (the `POST` behind `opctl app publish --yes`). The server extracts an
|
|
619
|
-
* alias-keyed contract from the app (fresh aliases; `renames` fixes them before
|
|
620
|
-
* v1 freezes), creates the registry package (name/description from the app),
|
|
621
|
-
* publishes v1 from the app's deployed source + dist, and pins the origin as
|
|
622
|
-
* installation #1. Error findings from extract surface as a 409. An
|
|
623
|
-
* already-linked app must use `releasePackage` instead. Admin-only. Backs
|
|
624
|
-
* `opctl app publish <app_id>`.
|
|
625
|
-
*/
|
|
626
|
-
publishAppAsPackage(app_id: string, body: {
|
|
627
|
-
renames?: Array<{
|
|
628
|
-
from: string;
|
|
629
|
-
to: string;
|
|
630
|
-
}>;
|
|
602
|
+
requestStarterPublish(body: StarterPublishRequest & {
|
|
631
603
|
changelog?: string | null;
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
doc_id: string;
|
|
636
|
-
}>;
|
|
637
|
-
}): Promise<{
|
|
638
|
-
package_id: string;
|
|
639
|
-
version: number;
|
|
640
|
-
app_id: string;
|
|
641
|
-
}>;
|
|
604
|
+
}): Promise<StarterPublish>;
|
|
605
|
+
/** The state of a publish: which app is building, and the version once every dist is in. */
|
|
606
|
+
getStarterPublish(publish_id: string): Promise<StarterPublish>;
|
|
642
607
|
/**
|
|
643
608
|
* Resolve the display name + fields (incl. select options) of the given tables
|
|
644
609
|
* — the schema `lotics app codegen` turns into the runtime `.lotics/app_fields.ts`
|
package/dist/src/client.js
CHANGED
|
@@ -343,10 +343,10 @@ export class LoticsClient {
|
|
|
343
343
|
async editPackageListing(package_id, body) {
|
|
344
344
|
return this.request("POST", `/v1/packages/${encodeURIComponent(package_id)}/listing`, body);
|
|
345
345
|
}
|
|
346
|
-
// ---
|
|
347
|
-
// Authoring is server-side: apps via
|
|
348
|
-
// content
|
|
349
|
-
// client-side create-package / upload-bundle path.
|
|
346
|
+
// --- Starters (registry reads + copies) ---
|
|
347
|
+
// Authoring is server-side: apps via the publish job (`requestStarterPublish`),
|
|
348
|
+
// content starters via the `publish_content`/`release_content` tools. There is
|
|
349
|
+
// no client-side create-package / upload-bundle path.
|
|
350
350
|
/**
|
|
351
351
|
* The starters this organization can copy — Lotics-reviewed ones plus its own,
|
|
352
352
|
* never a catalogue of everything published. The server returns exactly what
|
|
@@ -359,10 +359,9 @@ export class LoticsClient {
|
|
|
359
359
|
* Copy a starter into the current workspace.
|
|
360
360
|
*
|
|
361
361
|
* Server-side this scaffolds the schema, creates the templates, docs and
|
|
362
|
-
* sample records, creates
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
* presigned GET of that source, and finishing the job is the caller's half.
|
|
362
|
+
* sample records, creates every app the starter carries and deploys each
|
|
363
|
+
* from its prebuilt dist — no build anywhere. `apps` reports each deploy;
|
|
364
|
+
* one that failed carries its `error` and the copy is complete around it.
|
|
366
365
|
* Admin-only.
|
|
367
366
|
*/
|
|
368
367
|
async instantiateStarter(starter_id, body) {
|
|
@@ -415,68 +414,51 @@ export class LoticsClient {
|
|
|
415
414
|
async getWorkspaceDanglingReferences() {
|
|
416
415
|
return this.request("GET", "/v1/workspaces/dangling-references");
|
|
417
416
|
}
|
|
417
|
+
// --- Starter publishing (the authoring verbs; copying is `instantiateStarter`) ---
|
|
418
418
|
/**
|
|
419
|
-
* Preview a
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* owning-org only.
|
|
419
|
+
* Preview publishing a set of this workspace's apps as one starter version —
|
|
420
|
+
* the GET behind `opctl starter publish` (no `--yes`). The server runs the
|
|
421
|
+
* same extraction the publish runs and reports which starter it would
|
|
422
|
+
* release into (null: it would mint one), the next version, the aliases a
|
|
423
|
+
* first publish can still rename, the diff against the current version, the
|
|
424
|
+
* knowledge delta, and the findings (an `error` blocks the publish). No
|
|
425
|
+
* writes. Admin-only.
|
|
427
426
|
*/
|
|
428
|
-
async
|
|
427
|
+
async previewStarterPublish(opts) {
|
|
429
428
|
const params = new URLSearchParams();
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return this.request("GET", `/v1/apps/${encodeURIComponent(app_id)}/package-release${query ? `?${query}` : ""}`);
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Release — snapshot the origin app into the next registry version. The server
|
|
438
|
-
* binding-aware-extracts it, repackages its deployed source + dist as the
|
|
439
|
-
* bundle, publishes the next `release`-channel version with the changelog, and
|
|
440
|
-
* re-pins the origin. An optional `knowledge` declaration re-declares the
|
|
441
|
-
* bundled-knowledge set (added/dropped/re-snapshotted docs; omitted preserves
|
|
442
|
-
* the current corpus). Error findings from extract surface as a 409; a
|
|
443
|
-
* missing/archived declared doc is a 400, a foreign-package doc a 409. Admin,
|
|
444
|
-
* owning-org only. Backs `opctl app release --yes`.
|
|
445
|
-
*/
|
|
446
|
-
async releasePackage(app_id, body) {
|
|
447
|
-
return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-release`, body);
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Dry-run preview of a first-release — the `GET` behind `opctl app publish`
|
|
451
|
-
* (no `--yes`), the publish-side analogue of `previewPackageRelease`. The
|
|
452
|
-
* server runs the same fresh-alias extract + `src/` scan the apply runs
|
|
453
|
-
* (through any `renames`) and returns the package name it would mint, the
|
|
454
|
-
* auto-minted RENAMABLE aliases (the exact `--rename` keys), and the extract
|
|
455
|
-
* findings (an `error` blocks the apply). No writes. Admin-only.
|
|
456
|
-
*/
|
|
457
|
-
async previewPublishAppPackage(app_id, opts = {}) {
|
|
458
|
-
const params = new URLSearchParams();
|
|
459
|
-
if (opts.knowledge !== undefined && opts.knowledge.length > 0) {
|
|
460
|
-
params.set("knowledge", JSON.stringify(opts.knowledge));
|
|
461
|
-
}
|
|
462
|
-
if (opts.renames !== undefined && opts.renames.length > 0) {
|
|
429
|
+
params.set("app_ids", opts.app_ids.join(","));
|
|
430
|
+
if (opts.knowledge_doc_ids !== undefined)
|
|
431
|
+
params.set("knowledge_doc_ids", opts.knowledge_doc_ids.join(","));
|
|
432
|
+
if (opts.renames !== undefined && opts.renames.length > 0)
|
|
463
433
|
params.set("renames", JSON.stringify(opts.renames));
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
434
|
+
if (opts.name !== undefined)
|
|
435
|
+
params.set("name", opts.name);
|
|
436
|
+
if (opts.description !== undefined)
|
|
437
|
+
params.set("description", opts.description);
|
|
438
|
+
if (opts.icon !== undefined)
|
|
439
|
+
params.set("icon", opts.icon);
|
|
440
|
+
if (opts.color !== undefined)
|
|
441
|
+
params.set("color", opts.color);
|
|
442
|
+
return this.request("GET", `/v1/starters/publish-preview?${params.toString()}`);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Publish this workspace's apps as a starter version — a JOB, because every
|
|
446
|
+
* app is built once against sentinel field keys and eleven builds outlast a
|
|
447
|
+
* request. Everything a request can refuse is refused here with nothing
|
|
448
|
+
* written: a blocking finding or another publish still running for this
|
|
449
|
+
* org (409), a missing deploy or a bad declaration (400). The response is
|
|
450
|
+
* the job to poll with `getStarterPublish`. Admin-only.
|
|
451
|
+
*/
|
|
452
|
+
async requestStarterPublish(body) {
|
|
453
|
+
const { color, ...rest } = body;
|
|
454
|
+
return this.request("POST", "/v1/starters/publishes", {
|
|
455
|
+
...rest,
|
|
456
|
+
...(color !== undefined ? { theme: { color } } : {}),
|
|
457
|
+
});
|
|
467
458
|
}
|
|
468
|
-
/**
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
* alias-keyed contract from the app (fresh aliases; `renames` fixes them before
|
|
472
|
-
* v1 freezes), creates the registry package (name/description from the app),
|
|
473
|
-
* publishes v1 from the app's deployed source + dist, and pins the origin as
|
|
474
|
-
* installation #1. Error findings from extract surface as a 409. An
|
|
475
|
-
* already-linked app must use `releasePackage` instead. Admin-only. Backs
|
|
476
|
-
* `opctl app publish <app_id>`.
|
|
477
|
-
*/
|
|
478
|
-
async publishAppAsPackage(app_id, body) {
|
|
479
|
-
return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-publish`, body);
|
|
459
|
+
/** The state of a publish: which app is building, and the version once every dist is in. */
|
|
460
|
+
async getStarterPublish(publish_id) {
|
|
461
|
+
return this.request("GET", `/v1/starters/publishes/${encodeURIComponent(publish_id)}`);
|
|
480
462
|
}
|
|
481
463
|
/**
|
|
482
464
|
* Resolve the display name + fields (incl. select options) of the given tables
|
package/docs/cli_reference.md
CHANGED
|
@@ -41,10 +41,10 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
41
41
|
| `lotics app deploy [--prune] -m <message>` | `-m` is OPTIONAL — omitted, the deploy derives the version message from what it actually pushed; pass `-m` when you have a reason worth recording. npm run build; tar source + dist; POST /v1/apps/{id}/versions multipart. **One command ships everything**: before the bundle moves, a deploy pushes every binding the project has ahead of the app — an edited workflow body or declaration, edited agent prose, a changed query — through `set_app_query`, then `set_app_workflow`, then `set_app_agent`, and fails the release if any push is refused. That order is required: an agent declares the query and workflow aliases it may call, so pushing it before its own new query is refused. A workflow's `description` is part of that push and is compared against the recorded baseline, not the live app — it lives on the workflow ROW, which `getApp` does not carry. It never AUTHORS a binding itself — those verbs stay the single writers — and each push carries the fingerprint the project last saw live (`lotics.synced`), so a stale checkout is refused rather than overwriting another author's edit. `package.json` means the same thing for both artifacts: editing `lotics.agents.<alias>.inputs`/`outputs` is pushed exactly like the workflow equivalent (only those two fields — `set_app_agent` merges, so everything the manifest does not model is left untouched). It also regenerates `.lotics/app_fields.ts` before building, since the build INLINES it and a stale copy would ship ids that no longer name what the source thinks they do. `lotics app check` reports the same set without pushing; neither has a `--strict`. What the version RECORDS as the aliases it calls — the set `remove_app_workflow` / `remove_app_query` / `remove_app_agent` consult to refuse unbinding one the served version still reaches — is read by the SERVER out of the source archive this deploy uploads, not reported by the deploy. That matters because the deploy is also what unbinds: a client supplying the evidence used to refuse its own removal cannot be checked by it. After a successful deploy it warns about any alias the source CALLS that is NOT bound, and **names the inverse** — but as a TRANSITION, not a state: bindings this bundle *stopped* calling, compared against what the previous deploy's bundle called (`package.json#lotics.bundle_calls`, which a deploy records). It does NOT remove them: **`--prune` does, and only when passed.** The distinction is what makes the report readable. A static scan sees the bundle's call sites and an agent's `query_aliases`/`workflow_aliases`; it cannot see `lotics run run_app_query`/`run_app_workflow`, whose whole contract is that the alias is bound server-side, or chat's call under `app:use` — and the capability catalog publishes EVERY declared alias to both. So an alias the bundle never called is the normal shape of an agent-facing binding, not a dead one, and reporting it fired on every app built to be driven by an agent while pointing at the flag that deletes it. An alias that WAS called and is not any more is different: that is a call site the author removed, which is compile-, check- and deploy-clean while the binding keeps serving. **No baseline ⇒ nothing reported** — a manifest from before this field, or one a `pull` rebuilt from the server row, costs one quiet deploy and then self-heals, because silence is the only honest answer with nothing to compare. The baseline is STICKY: it advances only once nothing is outstanding, so the `--prune` this warning names still finds the transition on a later run instead of reporting ✓ over a binding that still serves. Pruning runs AFTER the version is live, because the removal tools refuse an alias the SERVED version still declares — so doing it first is refused by the guard that makes it safe. `--prune` is skipped ENTIRELY (with a warning, never a failure) when the source computes an alias at run time, since the scan cannot tell which binding that reaches and pruning "the rest" would be guessing with a deletion. **A removal DELETES the local declaration too** — `package.json#lotics.<kind>.<alias>` and its `synced` baseline — because leaving it would undo the prune: the manifest is what the next plain deploy pushes FROM, so the binding came straight back. That makes the act destructive rather than merely reversible, so what it deleted is written to `.lotics/pruned/<kind>/<alias>.json` and the ✓ names that file plus the `set` verb that re-binds it, on the same line. (These trees are never committed, so git is not the fallback; `lotics app pull --from-version <apv_…>` is the only other route back.) After a successful prune the generated companions are regenerated from the narrowed manifest — the `.d.ts` set and, when a query was pruned, `.lotics/app_fields.ts`, whose table set is derived from the surviving query ASTs. A table named ONLY by the pruned query leaves `F`/`OPT`, which is reported: if your source still addresses it, add the table id to `package.json#lotics.codegen.tables`. A local write that fails at any of this reports what could not be written and which aliases were already unbound server-side; it never fails the release, which is already live. A binding that will not unbind is reported and does NOT fail the release: the version is live and correct — and the server refuses to unbind a WORKFLOW this workspace has actually run (a recorded execution means a caller the source cannot name), which surfaces here as `✗ could not unbind …` with the date it last ran. After a successful deploy it also REFRESHES the `.lotics/workflows/<alias>.globals.d.ts` of any alias whose `// lotics:declaration` stamp says this deploy moved its declaration (only those — refreshing every bound alias would cost one round trip each on every deploy to fix something only ever wrong right after a manifest edit), from the manifest declaration, re-wrapping the SAME on-disk body (never re-fetching it, so local edits survive). A deploy is the moment the manifest becomes real, so it is also the moment the local types stop matching it — and the author's next act is usually `workflow set`, whose body would otherwise be typechecked against the declaration as it stood before this deploy. Non-fatal: the release already shipped, and stale types never fail it. |
|
|
42
42
|
| `lotics app versions [app_id]` | `GET /v1/apps/{id}/versions` — print deploy history newest-first (version number, timestamp, deployer name, build status, the `-m` message; `*` marks the currently-served version). app_id from the local manifest, or pass one to inspect any app without pulling it. Admin-only server-side (mirrors deploy + source download). Answers "what shipped, when, by whom" — e.g. whether a fix was live at an incident's time. Title → stderr, table → stdout (pipeable). |
|
|
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
|
-
| `lotics setup <starter_id> [
|
|
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
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
|
|
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, the created record ids are 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. |
|