@lotics/cli 0.104.0 → 0.105.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 +3 -1
- package/dist/src/cli.js +161 -38
- package/docs/cli_reference.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -197,7 +197,7 @@ lotics knowledge rm kdc_... # archive
|
|
|
197
197
|
```bash
|
|
198
198
|
# Scaffold / pull / deploy a Vite+React+TS app project
|
|
199
199
|
lotics app create "Sales Desk" # scaffold + deploy v1
|
|
200
|
-
lotics app pull app_... # bootstrap an existing app locally
|
|
200
|
+
lotics app pull app_... # bootstrap an existing app locally (incl. .lotics/*)
|
|
201
201
|
lotics app deploy -m "Add quote drawer" # build + upload a new version
|
|
202
202
|
lotics app versions # deploy history: version, when, who, -m message (* = live)
|
|
203
203
|
lotics app versions app_... # ...for any app, without pulling it first
|
|
@@ -205,6 +205,8 @@ lotics app versions app_... # ...for any app, without pulling it
|
|
|
205
205
|
# Regenerate .lotics/* WITHOUT a deploy: the .d.ts type companions (always) +
|
|
206
206
|
# the runtime app_fields.ts (when authenticated) — F/OPT maps that address
|
|
207
207
|
# fields + select options by stable display-name aliases instead of opaque ids.
|
|
208
|
+
# `app pull` writes both too (a deploy archive can never carry app_fields.ts);
|
|
209
|
+
# use this after a rename, or when a pull ran offline.
|
|
208
210
|
lotics app codegen # import { F, OPT } from "../.lotics/app_fields"
|
|
209
211
|
|
|
210
212
|
# Execute a bound app workflow end-to-end (inputs: inline / @file / stdin)
|
package/dist/src/cli.js
CHANGED
|
@@ -35953,7 +35953,7 @@ var require_stream_readable = __commonJS({
|
|
|
35953
35953
|
increasedAwaitDrain = false;
|
|
35954
35954
|
var ret = dest.write(chunk);
|
|
35955
35955
|
if (false === ret && !increasedAwaitDrain) {
|
|
35956
|
-
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 &&
|
|
35956
|
+
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf3(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
35957
35957
|
debug("false write response, pause", state.awaitDrain);
|
|
35958
35958
|
state.awaitDrain++;
|
|
35959
35959
|
increasedAwaitDrain = true;
|
|
@@ -36025,7 +36025,7 @@ var require_stream_readable = __commonJS({
|
|
|
36025
36025
|
}
|
|
36026
36026
|
return this;
|
|
36027
36027
|
}
|
|
36028
|
-
var index =
|
|
36028
|
+
var index = indexOf3(state.pipes, dest);
|
|
36029
36029
|
if (index === -1) return this;
|
|
36030
36030
|
state.pipes.splice(index, 1);
|
|
36031
36031
|
state.pipesCount -= 1;
|
|
@@ -36246,7 +36246,7 @@ var require_stream_readable = __commonJS({
|
|
|
36246
36246
|
stream.emit("end");
|
|
36247
36247
|
}
|
|
36248
36248
|
}
|
|
36249
|
-
function
|
|
36249
|
+
function indexOf3(xs, x2) {
|
|
36250
36250
|
for (var i2 = 0, l = xs.length; i2 < l; i2++) {
|
|
36251
36251
|
if (xs[i2] === x2) return i2;
|
|
36252
36252
|
}
|
|
@@ -47367,7 +47367,7 @@ function walk(node, visit) {
|
|
|
47367
47367
|
}
|
|
47368
47368
|
|
|
47369
47369
|
// src/generate_app_fields.ts
|
|
47370
|
-
var HEADER = `// Auto-generated by 'lotics app codegen'
|
|
47370
|
+
var HEADER = `// Auto-generated by 'lotics app codegen' and 'lotics app pull'.
|
|
47371
47371
|
// DO NOT EDIT \u2014 regenerated from the workspace schema.
|
|
47372
47372
|
//
|
|
47373
47373
|
// Runtime field + option ids addressed by stable display-name aliases:
|
|
@@ -47486,7 +47486,7 @@ export type AppOptions = typeof OPT;
|
|
|
47486
47486
|
}
|
|
47487
47487
|
|
|
47488
47488
|
// src/generate_package_fields.ts
|
|
47489
|
-
var HEADER2 = `// Auto-generated by 'lotics app codegen' (linked/published app
|
|
47489
|
+
var HEADER2 = `// Auto-generated by 'lotics app codegen' and 'lotics app pull' (linked/published app).
|
|
47490
47490
|
// DO NOT EDIT \u2014 regenerated from the installation's live binding.
|
|
47491
47491
|
//
|
|
47492
47492
|
// A package installation resolves F/OPT/ROLE at MODULE LOAD from its binding
|
|
@@ -70527,6 +70527,43 @@ function writeBindingAppFields(projectDir, binding) {
|
|
|
70527
70527
|
ensureAppVitestSetup(projectDir);
|
|
70528
70528
|
return file2;
|
|
70529
70529
|
}
|
|
70530
|
+
async function writeGeneratedAppFields(client, projectDir, app, queries) {
|
|
70531
|
+
if (client.viewAsMemberId) {
|
|
70532
|
+
console.error(
|
|
70533
|
+
`\u26A0 Skipped .lotics/app_fields.ts \u2014 running with --view-as ${client.viewAsMemberId}. The schema is read as that member, so any table they cannot see would be silently missing from F/OPT. Re-run without --view-as to regenerate it.`
|
|
70534
|
+
);
|
|
70535
|
+
return;
|
|
70536
|
+
}
|
|
70537
|
+
try {
|
|
70538
|
+
if (app.package_id) {
|
|
70539
|
+
const binding = await client.appBinding(app.app_id);
|
|
70540
|
+
const fieldsPath = writeBindingAppFields(projectDir, binding);
|
|
70541
|
+
const count = Object.keys(binding.fields).length;
|
|
70542
|
+
console.error(
|
|
70543
|
+
`Wrote ${fieldsPath} (binding form \u2014 linked to package ${app.package_id}; ${count} field alias${count === 1 ? "" : "es"} resolved per-install)`
|
|
70544
|
+
);
|
|
70545
|
+
} else {
|
|
70546
|
+
const tableIds = resolveCodegenTableIds(projectDir, queries);
|
|
70547
|
+
const tables = await client.getWorkspaceSchema(tableIds);
|
|
70548
|
+
const fieldsPath = writeAppFields(projectDir, tables);
|
|
70549
|
+
console.error(
|
|
70550
|
+
`Wrote ${fieldsPath} (baked form \u2014 bespoke; ${tables.length} table${tables.length === 1 ? "" : "s"})`
|
|
70551
|
+
);
|
|
70552
|
+
}
|
|
70553
|
+
} catch (err2) {
|
|
70554
|
+
warnAppFieldsUnwritten(projectDir, err2);
|
|
70555
|
+
}
|
|
70556
|
+
}
|
|
70557
|
+
function warnAppFieldsUnwritten(projectDir, err2) {
|
|
70558
|
+
const reason = err2 instanceof Error ? err2.message : String(err2);
|
|
70559
|
+
if (fs4.existsSync(path5.join(projectDir, ".lotics", "app_fields.ts"))) {
|
|
70560
|
+
console.error(`\u26A0 Could not regenerate .lotics/app_fields.ts (${reason}). Kept the existing file.`);
|
|
70561
|
+
return;
|
|
70562
|
+
}
|
|
70563
|
+
console.error(
|
|
70564
|
+
`\u26A0 Could not generate .lotics/app_fields.ts (${reason}), and this project has none. Any source importing F/OPT will fail to build with 'Could not resolve "../../.lotics/app_fields"'. Run 'lotics app codegen' once you can reach the workspace.`
|
|
70565
|
+
);
|
|
70566
|
+
}
|
|
70530
70567
|
function warnIfDeployingLinkedKit(projectDir) {
|
|
70531
70568
|
const uiSrc = process.env.LOTICS_UI_SRC;
|
|
70532
70569
|
if (!uiSrc) return;
|
|
@@ -70596,23 +70633,14 @@ async function appCodegen(args) {
|
|
|
70596
70633
|
}
|
|
70597
70634
|
try {
|
|
70598
70635
|
const app = await args.client.getApp(meta3.app_id);
|
|
70599
|
-
|
|
70600
|
-
|
|
70601
|
-
|
|
70602
|
-
|
|
70603
|
-
|
|
70604
|
-
`Regenerated ${fieldsPath} (binding form \u2014 ${count} field alias${count === 1 ? "" : "es"} resolved per-install)`
|
|
70605
|
-
);
|
|
70606
|
-
} else {
|
|
70607
|
-
const tableIds = resolveCodegenTableIds(projectDir, meta3.queries ?? {});
|
|
70608
|
-
const tables = await args.client.getWorkspaceSchema(tableIds);
|
|
70609
|
-
const fieldsPath = writeAppFields(projectDir, tables);
|
|
70610
|
-
console.error(`Regenerated ${fieldsPath} (${tables.length} table${tables.length === 1 ? "" : "s"})`);
|
|
70611
|
-
}
|
|
70612
|
-
} catch (err2) {
|
|
70613
|
-
console.error(
|
|
70614
|
-
`\u26A0 Could not regenerate .lotics/app_fields.ts (${err2 instanceof Error ? err2.message : String(err2)}). Kept the existing file.`
|
|
70636
|
+
await writeGeneratedAppFields(
|
|
70637
|
+
args.client,
|
|
70638
|
+
projectDir,
|
|
70639
|
+
{ app_id: meta3.app_id, package_id: app.package_id },
|
|
70640
|
+
meta3.queries ?? {}
|
|
70615
70641
|
);
|
|
70642
|
+
} catch (err2) {
|
|
70643
|
+
warnAppFieldsUnwritten(projectDir, err2);
|
|
70616
70644
|
}
|
|
70617
70645
|
await refreshWorkflowGlobals(args.client, projectDir, meta3.app_id, meta3.workflows ?? {});
|
|
70618
70646
|
}
|
|
@@ -70805,6 +70833,12 @@ async function appPull(client, args) {
|
|
|
70805
70833
|
queries: app.queries ?? {},
|
|
70806
70834
|
agents: app.agents ?? {}
|
|
70807
70835
|
});
|
|
70836
|
+
await writeGeneratedAppFields(
|
|
70837
|
+
client,
|
|
70838
|
+
targetPath,
|
|
70839
|
+
{ app_id: app.id, package_id: app.package_id },
|
|
70840
|
+
app.queries ?? {}
|
|
70841
|
+
);
|
|
70808
70842
|
const workflows = app.workflows ?? {};
|
|
70809
70843
|
if (Object.keys(workflows).length > 0) {
|
|
70810
70844
|
const written = await writeWorkflowFiles(client, targetPath, app.id, app.name, workflows);
|
|
@@ -89700,6 +89734,93 @@ function getAttr2(el, attr) {
|
|
|
89700
89734
|
return attrs?.[`@_${attr}`];
|
|
89701
89735
|
}
|
|
89702
89736
|
|
|
89737
|
+
// ../ooxml/src/schema_order.ts
|
|
89738
|
+
var PPR_ORDER = [
|
|
89739
|
+
"w:pStyle",
|
|
89740
|
+
"w:keepNext",
|
|
89741
|
+
"w:keepLines",
|
|
89742
|
+
"w:pageBreakBefore",
|
|
89743
|
+
"w:framePr",
|
|
89744
|
+
"w:widowControl",
|
|
89745
|
+
"w:numPr",
|
|
89746
|
+
"w:suppressLineNumbers",
|
|
89747
|
+
"w:pBdr",
|
|
89748
|
+
"w:shd",
|
|
89749
|
+
"w:tabs",
|
|
89750
|
+
"w:suppressAutoHyphens",
|
|
89751
|
+
"w:kinsoku",
|
|
89752
|
+
"w:wordWrap",
|
|
89753
|
+
"w:overflowPunct",
|
|
89754
|
+
"w:topLinePunct",
|
|
89755
|
+
"w:autoSpaceDE",
|
|
89756
|
+
"w:autoSpaceDN",
|
|
89757
|
+
"w:bidi",
|
|
89758
|
+
"w:adjustRightInd",
|
|
89759
|
+
"w:snapToGrid",
|
|
89760
|
+
"w:spacing",
|
|
89761
|
+
"w:ind",
|
|
89762
|
+
"w:contextualSpacing",
|
|
89763
|
+
"w:mirrorIndents",
|
|
89764
|
+
"w:suppressOverlap",
|
|
89765
|
+
"w:jc",
|
|
89766
|
+
"w:textDirection",
|
|
89767
|
+
"w:textAlignment",
|
|
89768
|
+
"w:textboxTightWrap",
|
|
89769
|
+
"w:outlineLvl",
|
|
89770
|
+
"w:divId",
|
|
89771
|
+
"w:cnfStyle",
|
|
89772
|
+
"w:rPr",
|
|
89773
|
+
"w:sectPr",
|
|
89774
|
+
"w:pPrChange"
|
|
89775
|
+
];
|
|
89776
|
+
var RPR_ORDER = [
|
|
89777
|
+
"w:rStyle",
|
|
89778
|
+
"w:rFonts",
|
|
89779
|
+
"w:b",
|
|
89780
|
+
"w:bCs",
|
|
89781
|
+
"w:i",
|
|
89782
|
+
"w:iCs",
|
|
89783
|
+
"w:caps",
|
|
89784
|
+
"w:smallCaps",
|
|
89785
|
+
"w:strike",
|
|
89786
|
+
"w:dstrike",
|
|
89787
|
+
"w:outline",
|
|
89788
|
+
"w:shadow",
|
|
89789
|
+
"w:emboss",
|
|
89790
|
+
"w:imprint",
|
|
89791
|
+
"w:noProof",
|
|
89792
|
+
"w:snapToGrid",
|
|
89793
|
+
"w:vanish",
|
|
89794
|
+
"w:webHidden",
|
|
89795
|
+
"w:color",
|
|
89796
|
+
"w:spacing",
|
|
89797
|
+
"w:w",
|
|
89798
|
+
"w:kern",
|
|
89799
|
+
"w:position",
|
|
89800
|
+
"w:sz",
|
|
89801
|
+
"w:szCs",
|
|
89802
|
+
"w:highlight",
|
|
89803
|
+
"w:u",
|
|
89804
|
+
"w:effect",
|
|
89805
|
+
"w:bdr",
|
|
89806
|
+
"w:shd",
|
|
89807
|
+
"w:fitText",
|
|
89808
|
+
"w:vertAlign",
|
|
89809
|
+
"w:rtl",
|
|
89810
|
+
"w:cs",
|
|
89811
|
+
"w:em",
|
|
89812
|
+
"w:lang",
|
|
89813
|
+
"w:eastAsianLayout",
|
|
89814
|
+
"w:specVanish",
|
|
89815
|
+
"w:oMath",
|
|
89816
|
+
"w:rPrChange"
|
|
89817
|
+
];
|
|
89818
|
+
function indexOf2(order) {
|
|
89819
|
+
return new Map(order.map((tag, i2) => [tag, i2]));
|
|
89820
|
+
}
|
|
89821
|
+
var PPR_INDEX = indexOf2(PPR_ORDER);
|
|
89822
|
+
var RPR_INDEX = indexOf2(RPR_ORDER);
|
|
89823
|
+
|
|
89703
89824
|
// ../ooxml/src/formatting.ts
|
|
89704
89825
|
var formattingSchema = external_exports.object({
|
|
89705
89826
|
bold: external_exports.boolean().optional(),
|
|
@@ -90564,23 +90685,25 @@ var DOCUMENT_RELS_XML = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
|
90564
90685
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
90565
90686
|
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
90566
90687
|
</Relationships>`;
|
|
90567
|
-
|
|
90568
|
-
|
|
90569
|
-
|
|
90570
|
-
|
|
90571
|
-
|
|
90572
|
-
|
|
90573
|
-
"
|
|
90574
|
-
|
|
90575
|
-
|
|
90576
|
-
|
|
90577
|
-
|
|
90578
|
-
|
|
90579
|
-
|
|
90688
|
+
function buildDefaultSectPr() {
|
|
90689
|
+
return {
|
|
90690
|
+
"w:sectPr": [
|
|
90691
|
+
{ "w:pgSz": [], ":@": { "@_w:w": "12240", "@_w:h": "15840" } },
|
|
90692
|
+
{
|
|
90693
|
+
"w:pgMar": [],
|
|
90694
|
+
":@": {
|
|
90695
|
+
"@_w:top": "1440",
|
|
90696
|
+
"@_w:right": "1440",
|
|
90697
|
+
"@_w:bottom": "1440",
|
|
90698
|
+
"@_w:left": "1440",
|
|
90699
|
+
"@_w:header": "720",
|
|
90700
|
+
"@_w:footer": "720",
|
|
90701
|
+
"@_w:gutter": "0"
|
|
90702
|
+
}
|
|
90580
90703
|
}
|
|
90581
|
-
|
|
90582
|
-
|
|
90583
|
-
}
|
|
90704
|
+
]
|
|
90705
|
+
};
|
|
90706
|
+
}
|
|
90584
90707
|
var DEFAULT_HEADING_SIZES = [32, 26, 24, 22, 20, 18];
|
|
90585
90708
|
function escapeXmlAttr(value) {
|
|
90586
90709
|
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -90676,7 +90799,7 @@ function createBlankDocx(opts) {
|
|
|
90676
90799
|
default_font: opts?.default_font,
|
|
90677
90800
|
default_font_size: opts?.default_font_size
|
|
90678
90801
|
}));
|
|
90679
|
-
const bodyElements = [
|
|
90802
|
+
const bodyElements = [buildDefaultSectPr()];
|
|
90680
90803
|
const documentAttrs = { ...DOCUMENT_ATTRS };
|
|
90681
90804
|
if (opts?.page) setPageLayout(bodyElements, opts.page);
|
|
90682
90805
|
return { zip, bodyElements, documentAttrs };
|
package/docs/cli_reference.md
CHANGED
|
@@ -29,7 +29,7 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
29
29
|
| `lotics knowledge update <id> [--from <file.md> \| --content <str>] [--name <n>] [--description <d>]` | Call `update_knowledge` with **only** the provided fields (a body from --from/--content becomes `content`; the tool diffs + CASes the content change internally, so the CLI passes no `expected_content_file_id`). At least one field required; --from and --content are mutually exclusive. |
|
|
30
30
|
| `lotics knowledge rm <id>` | Archive the doc via `delete_knowledge` (`{ knowledge_doc_id }`). The REST execute path does not gate `needsApproval`, so this runs unattended. |
|
|
31
31
|
| `lotics app create <name> [path]` | Scaffold a Vite+React+TS custom-code app project; POST /v1/apps; npm install; vite build; upload as v1 |
|
|
32
|
-
| `lotics app pull <app_id> [path]` | Download source archive from R2 (presigned), extract, npm install, stamp package.json's `lotics` field. With no `[path]`: refresh the cwd IN PLACE when it's already this app's own project (its manifest `app_id` matches — the documented `cd <app> && lotics app pull` flow), else clone into an `<name>/` subdir; this avoids the stray nested `./<name>/` subdir a pull-from-inside-the-app used to drop. — `workflows` and `agents` are sourced from the live App row (NOT the archived manifest), so `set_app_workflow` / `set_app_agent` authoring survives the pull. Regenerates `.lotics/app_{workflows,queries,agents}.d.ts` so `useWorkflow` / `useQuery` / `useAgentRun` stay typed. Also writes one `src/workflows/<alias>.ts` per bound workflow (faithful body from `get_app_workflow`) and one `src/agents/<alias>.md` per bound agent (its instructions, straight off the live row) — so the prose an author actually edits lives in a file, and pull always overwrites it from live, leaving no second copy to drift. A legacy workflow alias with no rendered source, or an agent with no instructions, warns and is skipped. The stamped `lotics.agents` map carries the TYPED half only (`inputs`/`outputs`/`tool_names`/`model_id`/…) — an agent's prose lives solely in its `.md`, so there is never a second local copy to desync; a stale `instructions` left by an older CLI is inert and disappears on the next pull |
|
|
32
|
+
| `lotics app pull <app_id> [path]` | Download source archive from R2 (presigned), extract, npm install, stamp package.json's `lotics` field. With no `[path]`: refresh the cwd IN PLACE when it's already this app's own project (its manifest `app_id` matches — the documented `cd <app> && lotics app pull` flow), else clone into an `<name>/` subdir; this avoids the stray nested `./<name>/` subdir a pull-from-inside-the-app used to drop. — `workflows` and `agents` are sourced from the live App row (NOT the archived manifest), so `set_app_workflow` / `set_app_agent` authoring survives the pull. Regenerates `.lotics/app_{workflows,queries,agents}.d.ts` so `useWorkflow` / `useQuery` / `useAgentRun` stay typed, AND the runtime `.lotics/app_fields.ts` (the same linked-vs-bespoke branch `app codegen` runs, off the app row already fetched — see that row for the two forms). That one is not optional: `app deploy` tars source with `--exclude=.lotics`, so no archive can carry it, and a pulled project whose `src/` imports `F`/`OPT` would fail to build with `Could not resolve "../../.lotics/app_fields"` until `app codegen` was run by hand. The write NAMES the form and the reason, because an in-place pull can FLIP a project between them (`opctl app publish` links an origin, `package eject` unlinks it) and that changes what the module does at load. Skipped under `--view-as` (the schema is read as that member and silently drops tables they cannot see — a narrowed `F` map compiles and then throws at runtime, worse than the missing module). A binding/schema fetch failure is non-fatal and names the right recovery for what is on disk: an existing file is kept, an ABSENT one warns about the build error and points at `app codegen`. Pull GENERATES but never RECONCILES `.lotics/` — deleting a companion whose alias the manifest no longer declares is `app codegen`'s alone, since pull's authority is the server's alias set and a declared-but-not-yet-`set` alias is supported. Also writes one `src/workflows/<alias>.ts` per bound workflow (faithful body from `get_app_workflow`) and one `src/agents/<alias>.md` per bound agent (its instructions, straight off the live row) — so the prose an author actually edits lives in a file, and pull always overwrites it from live, leaving no second copy to drift. A legacy workflow alias with no rendered source, or an agent with no instructions, warns and is skipped. The stamped `lotics.agents` map carries the TYPED half only (`inputs`/`outputs`/`tool_names`/`model_id`/…) — an agent's prose lives solely in its `.md`, so there is never a second local copy to desync; a stale `instructions` left by an older CLI is inert and disappears on the next pull |
|
|
33
33
|
| `lotics app deploy -m <message>` | **`-m` is REQUIRED** (CLI errors without a non-empty message) — each deploy is a version row read back by `lotics app versions`, so a blank message loses the audit trail. npm run build; tar source + dist; POST /v1/apps/{id}/versions multipart. Carries code + capabilities only — **neither queries nor workflow/agent bindings are a deploy concern** (`set_app_workflow` / `remove_app_workflow` own `apps.workflows`; the manifest's `workflows` map is a pulled reflection, read by `useWorkflow` codegen and by `app workflow set`, never written by a deploy). Deploy DOES send the manifest's `lotics.workflows` alias KEYS (not the bindings) as `workflow_aliases`, recorded on the version row so `remove_app_workflow` can refuse to unbind an alias the served version still declares. It also reports any `lotics.queries` alias whose declaration DIFFERS from the app's, naming both recoveries (`app query set --all` to push yours, `app pull` to adopt the app's) — a deploy no longer writes them, so the two are allowed to drift. After a successful deploy it **warns loudly about any alias the source CALLS that is NOT bound on the server** (a `getApp` diff via `warnIfUnboundAliases`) — since deploy never binds them, that would otherwise throw only at the app's first `useWorkflow` / `useAgentRun` call; the warning points to `lotics app workflow set` / `set_app_agent`. Advisory only (never fails the deploy). |
|
|
34
34
|
| `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. The deploy pipeline already persisted all of this in `app_versions`; this is the read surface. Title → stderr, table → stdout (pipeable). |
|
|
35
35
|
| `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` — **branched on whether the app is a package installation** (`getApp().package_id` set, from `generate_package_fields.ts`): a **linked/published** app emits the BINDING form (`F`/`OPT`/`ROLE` resolved from the installation's LIVE binding — via `appBinding` / the `binding` RPC — at module load through `getAppBinding()` + top-level await, so the source stays portable across every install); a **bespoke** app emits the BAKED form (`generate_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). Both forms share the `F`/`OPT` shape (contract aliases derive from the same slugified display names), so a published origin's deployed source compiles unchanged. Writing the BINDING form also heals the project's vitest setup (`ensureAppVitestSetup`, folded into the same write boundary): the binding form awaits `getAppBinding()` (a network call) at module load, so without a stub `npm test` fails to collect any test that imports the app graph — the heal writes `vitest.setup.ts` (mocks only `getAppBinding`, returning an echo binding: any alias → a self-identifying `fld:test:…`/`opt:test:…`/`grp:test:…` id) if absent, and warns the one-liner to add to `vite.config.ts`'s `test.setupFiles` if the wiring is missing (TS source isn't safely munged, mirroring `ensureAppTsconfig`'s JSONC-tsconfig warn). New scaffolds ship both. 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 (that directory is read as the app's alias inventory, so a companion for a binding nobody can reach misreports what the app has). 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). |
|