@lotics/cli 0.255.1 → 0.256.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/dist/src/cli.js +195 -33
- package/docs/building_an_app.md +2 -2
- package/docs/cli_reference.md +3 -3
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -57978,7 +57978,7 @@ function resultSideEffects(result) {
|
|
|
57978
57978
|
|
|
57979
57979
|
// src/version.ts
|
|
57980
57980
|
init_define_LOTICS_KIT_VERSIONS();
|
|
57981
|
-
var VERSION = "0.
|
|
57981
|
+
var VERSION = "0.256.0";
|
|
57982
57982
|
|
|
57983
57983
|
// src/timezone.ts
|
|
57984
57984
|
init_define_LOTICS_KIT_VERSIONS();
|
|
@@ -58642,7 +58642,8 @@ var COMMANDS = [
|
|
|
58642
58642
|
" that already exists live.",
|
|
58643
58643
|
" --dry-run prints the whole fold and writes nothing,",
|
|
58644
58644
|
" here or on the server",
|
|
58645
|
-
" lotics app pull <app_id> [path] Bootstrap full local env (source + npm install + types)",
|
|
58645
|
+
" lotics app pull <app_id> [path] Bootstrap full local env (source + npm install + types);",
|
|
58646
|
+
" an app with no screens is rebuilt from its live row",
|
|
58646
58647
|
" lotics app deploy [--prune] [-m <msg>]",
|
|
58647
58648
|
" Typecheck + build + upload current dir as a new version \u2014 COMMIT",
|
|
58648
58649
|
" (-m is OPTIONAL \u2014 omitted, the version message is",
|
|
@@ -65435,9 +65436,29 @@ function pruneOrphanWorkflowGlobals(projectDir, declared) {
|
|
|
65435
65436
|
return removed.sort();
|
|
65436
65437
|
}
|
|
65437
65438
|
function orphanWorkflowBodies(projectDir, declared) {
|
|
65439
|
+
return workflowBodyAliases(projectDir).filter((alias2) => !declared.has(alias2)).sort();
|
|
65440
|
+
}
|
|
65441
|
+
function workflowBodyAliases(projectDir) {
|
|
65438
65442
|
const dir = path13.join(projectDir, WORKFLOWS_DIR);
|
|
65439
65443
|
if (!fs12.existsSync(dir)) return [];
|
|
65440
|
-
return fs12.readdirSync(dir).filter((e) => e.endsWith(".ts") && !e.endsWith(".d.ts") && !e.endsWith(".test.ts")).map((e) => e.slice(0, -".ts".length))
|
|
65444
|
+
return fs12.readdirSync(dir).filter((e) => e.endsWith(".ts") && !e.endsWith(".d.ts") && !e.endsWith(".test.ts")).map((e) => e.slice(0, -".ts".length));
|
|
65445
|
+
}
|
|
65446
|
+
function localCapabilityShas(projectDir) {
|
|
65447
|
+
const agentsDir = path13.join(projectDir, AGENTS_DIR);
|
|
65448
|
+
return {
|
|
65449
|
+
workflows: Object.fromEntries(
|
|
65450
|
+
workflowBodyAliases(projectDir).map((alias2) => [
|
|
65451
|
+
alias2,
|
|
65452
|
+
contentSha(stripWorkflowHeader(fs12.readFileSync(workflowFilePath(projectDir, alias2), "utf-8")))
|
|
65453
|
+
])
|
|
65454
|
+
),
|
|
65455
|
+
agents: fs12.existsSync(agentsDir) ? Object.fromEntries(
|
|
65456
|
+
fs12.readdirSync(agentsDir).filter((e) => e.endsWith(".md")).map((e) => e.slice(0, -".md".length)).map((alias2) => [
|
|
65457
|
+
alias2,
|
|
65458
|
+
contentSha(stripAgentHeader(fs12.readFileSync(agentFilePath2(projectDir, alias2), "utf-8")))
|
|
65459
|
+
])
|
|
65460
|
+
) : {}
|
|
65461
|
+
};
|
|
65441
65462
|
}
|
|
65442
65463
|
var GLOBALS_STAMP_PREFIX = "// lotics:declaration ";
|
|
65443
65464
|
function workflowDeclarationStamp(declaration) {
|
|
@@ -65557,6 +65578,20 @@ function reportUnseenLive(kind, unseen, appId) {
|
|
|
65557
65578
|
Merge what you want from the live copy into your file and deploy, or run 'lotics app pull ${appId} --force' to take the live version and discard yours.`
|
|
65558
65579
|
);
|
|
65559
65580
|
}
|
|
65581
|
+
function parkLiveQuery(projectDir, alias2, declaration) {
|
|
65582
|
+
const dir = path13.join(projectDir, ".lotics", "queries");
|
|
65583
|
+
const file2 = path13.join(dir, `${alias2}.live.json`);
|
|
65584
|
+
try {
|
|
65585
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
65586
|
+
fs12.writeFileSync(file2, JSON.stringify(declaration, null, 2) + "\n");
|
|
65587
|
+
return path13.relative(projectDir, file2);
|
|
65588
|
+
} catch (err) {
|
|
65589
|
+
console.error(
|
|
65590
|
+
`\u26A0 Could not write the live query for ${alias2} to ${path13.relative(projectDir, file2)}: ${err instanceof Error ? err.message : String(err)}`
|
|
65591
|
+
);
|
|
65592
|
+
return null;
|
|
65593
|
+
}
|
|
65594
|
+
}
|
|
65560
65595
|
function parkLiveWorkflowBody(projectDir, alias2, source) {
|
|
65561
65596
|
const dir = path13.join(projectDir, WORKFLOW_GLOBALS_DIR);
|
|
65562
65597
|
const file2 = path13.join(dir, `${alias2}.live.ts`);
|
|
@@ -74901,22 +74936,8 @@ function stampAfterPull(args) {
|
|
|
74901
74936
|
return { ...older, held: true };
|
|
74902
74937
|
}
|
|
74903
74938
|
function stampPulledManifest(projectDir, args) {
|
|
74904
|
-
writeAppMeta(projectDir,
|
|
74905
|
-
|
|
74906
|
-
workspace_id: args.workspace_id,
|
|
74907
|
-
current_version_id: args.current_version_id,
|
|
74908
|
-
version_number: args.version_number,
|
|
74909
|
-
workflows: toManifestWorkflows(args.workflows),
|
|
74910
|
-
queries: args.queries,
|
|
74911
|
-
// The prose is stripped here and only here: `args.agents` is the LIVE map
|
|
74912
|
-
// (its instructions feed `writeAgentFiles`), the manifest gets the typed half.
|
|
74913
|
-
agents: toManifestAgents(args.agents)
|
|
74914
|
-
});
|
|
74915
|
-
writeAppDts(projectDir, {
|
|
74916
|
-
workflows: toManifestWorkflows(args.workflows),
|
|
74917
|
-
queries: args.queries,
|
|
74918
|
-
agents: toManifestAgents(args.agents)
|
|
74919
|
-
});
|
|
74939
|
+
writeAppMeta(projectDir, args);
|
|
74940
|
+
writeAppDts(projectDir, { workflows: args.workflows, queries: args.queries, agents: args.agents });
|
|
74920
74941
|
}
|
|
74921
74942
|
function appDirName(name) {
|
|
74922
74943
|
const cleaned = name.replace(/[/\\]+/g, "-").replace(/[<>:"|?*]/g, "").replace(/\s+/g, " ").trim().replace(/^[.\s-]+|[.\s-]+$/g, "");
|
|
@@ -74937,7 +74958,100 @@ function defaultPullTarget(appId, appName2) {
|
|
|
74937
74958
|
}
|
|
74938
74959
|
return appDirName(appName2);
|
|
74939
74960
|
}
|
|
74961
|
+
function resolvePulledQueries(args) {
|
|
74962
|
+
const queries = {};
|
|
74963
|
+
const synced = {};
|
|
74964
|
+
const kept = [];
|
|
74965
|
+
const unseenLive = [];
|
|
74966
|
+
for (const alias2 of /* @__PURE__ */ new Set([...Object.keys(args.live), ...Object.keys(args.local)])) {
|
|
74967
|
+
const live = args.live[alias2];
|
|
74968
|
+
const local = args.local[alias2];
|
|
74969
|
+
const base = args.baseline[alias2];
|
|
74970
|
+
const liveSha = live === void 0 ? void 0 : declarationSha(live);
|
|
74971
|
+
const localSha = local === void 0 ? void 0 : declarationSha(local);
|
|
74972
|
+
const edited = local !== void 0 && localSha !== liveSha && (base?.content === void 0 ? live === void 0 : localSha !== base.content);
|
|
74973
|
+
if (args.force || !edited) {
|
|
74974
|
+
if (live === void 0 || liveSha === void 0) continue;
|
|
74975
|
+
queries[alias2] = live;
|
|
74976
|
+
synced[alias2] = { content: liveSha, live: liveSha };
|
|
74977
|
+
continue;
|
|
74978
|
+
}
|
|
74979
|
+
queries[alias2] = local;
|
|
74980
|
+
kept.push(`package.json lotics.queries.${alias2}`);
|
|
74981
|
+
if (liveSha === void 0) continue;
|
|
74982
|
+
if (base?.live === void 0 || base.live === liveSha) {
|
|
74983
|
+
synced[alias2] = { ...base, live: liveSha };
|
|
74984
|
+
continue;
|
|
74985
|
+
}
|
|
74986
|
+
unseenLive.push(alias2);
|
|
74987
|
+
}
|
|
74988
|
+
return { queries, synced, kept, unseenLive };
|
|
74989
|
+
}
|
|
74990
|
+
function resolveUnboundFiles(args) {
|
|
74991
|
+
const unbound = [.../* @__PURE__ */ new Set([...Object.keys(args.files), ...Object.keys(args.baseline)])].filter((alias2) => !args.live.has(alias2)).sort();
|
|
74992
|
+
const unedited = (alias2) => {
|
|
74993
|
+
const file2 = args.files[alias2];
|
|
74994
|
+
return file2 === void 0 || file2 === args.baseline[alias2]?.content;
|
|
74995
|
+
};
|
|
74996
|
+
return {
|
|
74997
|
+
retired: unbound.filter((alias2) => args.force || unedited(alias2)),
|
|
74998
|
+
kept: unbound.filter((alias2) => !args.force && !unedited(alias2))
|
|
74999
|
+
};
|
|
75000
|
+
}
|
|
75001
|
+
function unboundAliases2(targetPath, app, force) {
|
|
75002
|
+
const files = localCapabilityShas(targetPath);
|
|
75003
|
+
const synced = readSynced(targetPath);
|
|
75004
|
+
const decide = (kind, live) => {
|
|
75005
|
+
const { retired, kept } = resolveUnboundFiles({
|
|
75006
|
+
live: new Set(Object.keys(live ?? {})),
|
|
75007
|
+
files: files[kind],
|
|
75008
|
+
baseline: synced[kind],
|
|
75009
|
+
force
|
|
75010
|
+
});
|
|
75011
|
+
return { retired, kept, authored: kept.filter((alias2) => !(alias2 in synced[kind])) };
|
|
75012
|
+
};
|
|
75013
|
+
return { workflows: decide("workflows", app.workflows), agents: decide("agents", app.agents) };
|
|
75014
|
+
}
|
|
75015
|
+
function authoredDeclarations(declared, authored) {
|
|
75016
|
+
return Object.fromEntries(authored.flatMap((alias2) => declared?.[alias2] ? [[alias2, declared[alias2]]] : []));
|
|
75017
|
+
}
|
|
75018
|
+
function retireUnboundAliases(targetPath, unbound, queries) {
|
|
75019
|
+
const declared = readAppMeta(targetPath);
|
|
75020
|
+
const kinds = [
|
|
75021
|
+
{ kind: "workflows", file: workflowFilePath, set: "workflow" },
|
|
75022
|
+
{ kind: "agents", file: agentFilePath2, set: "agent" }
|
|
75023
|
+
];
|
|
75024
|
+
for (const { kind, file: file2, set: set2 } of kinds) {
|
|
75025
|
+
const { retired, kept } = unbound[kind];
|
|
75026
|
+
for (const alias2 of retired) {
|
|
75027
|
+
fs17.rmSync(file2(targetPath, alias2), { force: true });
|
|
75028
|
+
if (kind === "workflows") fs17.rmSync(workflowGlobalsPath(targetPath, alias2), { force: true });
|
|
75029
|
+
removeFromManifest(targetPath, kind, alias2);
|
|
75030
|
+
}
|
|
75031
|
+
if (retired.length > 0) {
|
|
75032
|
+
note2(`Removed ${kind === "workflows" ? "workflow bodies" : "agent prompts"} the app no longer binds: ${retired.join(", ")}`);
|
|
75033
|
+
}
|
|
75034
|
+
for (const alias2 of kept) {
|
|
75035
|
+
warn(
|
|
75036
|
+
`\u26A0 ${path18.relative(targetPath, file2(targetPath, alias2))} is bound to nothing in the app and holds work this checkout never pushed, so it was kept. ${declared[kind]?.[alias2] ? "" : `Declare it in package.json#lotics.${kind}, then `}run 'lotics app ${set2} set ${alias2}' to ship it, or delete it.`
|
|
75037
|
+
);
|
|
75038
|
+
}
|
|
75039
|
+
}
|
|
75040
|
+
for (const alias2 of Object.keys(readSynced(targetPath).queries)) {
|
|
75041
|
+
if (!queries.has(alias2)) removeFromManifest(targetPath, "queries", alias2);
|
|
75042
|
+
}
|
|
75043
|
+
}
|
|
74940
75044
|
async function hydrateAppProject(client, targetPath, app, opts) {
|
|
75045
|
+
const liveQueries = app.queries ?? {};
|
|
75046
|
+
const resolved = resolvePulledQueries({
|
|
75047
|
+
live: liveQueries,
|
|
75048
|
+
local: readManifest(targetPath).lotics?.queries ?? {},
|
|
75049
|
+
baseline: readSynced(targetPath).queries,
|
|
75050
|
+
force: opts.force === true
|
|
75051
|
+
});
|
|
75052
|
+
opts.kept.push(...resolved.kept);
|
|
75053
|
+
const unbound = unboundAliases2(targetPath, app, opts.force === true);
|
|
75054
|
+
const local = readAppMeta(targetPath);
|
|
74941
75055
|
stampPulledManifest(targetPath, {
|
|
74942
75056
|
app_id: app.id,
|
|
74943
75057
|
workspace_id: app.workspace_id,
|
|
@@ -74947,14 +75061,23 @@ async function hydrateAppProject(client, targetPath, app, opts) {
|
|
|
74947
75061
|
// exactly that, and it can only do so if this tells the truth.
|
|
74948
75062
|
current_version_id: opts.stamp.id,
|
|
74949
75063
|
version_number: opts.stamp.number,
|
|
74950
|
-
workflows:
|
|
74951
|
-
|
|
74952
|
-
|
|
75064
|
+
workflows: {
|
|
75065
|
+
...authoredDeclarations(local.workflows, unbound.workflows.authored),
|
|
75066
|
+
...toManifestWorkflows(app.workflows ?? {})
|
|
75067
|
+
},
|
|
75068
|
+
queries: resolved.queries,
|
|
75069
|
+
// The prose is stripped here: `app.agents` is the LIVE map, whose instructions
|
|
75070
|
+
// feed `writeAgentFiles`; the manifest gets the typed half.
|
|
75071
|
+
agents: { ...authoredDeclarations(local.agents, unbound.agents.authored), ...toManifestAgents(app.agents ?? {}) }
|
|
74953
75072
|
});
|
|
74954
|
-
for (const [alias2,
|
|
74955
|
-
|
|
74956
|
-
writeSynced(targetPath, "queries", alias2, { content: sha, live: sha });
|
|
75073
|
+
for (const [alias2, entry] of Object.entries(resolved.synced)) {
|
|
75074
|
+
writeSynced(targetPath, "queries", alias2, entry);
|
|
74957
75075
|
}
|
|
75076
|
+
reportUnseenLive(
|
|
75077
|
+
"query",
|
|
75078
|
+
resolved.unseenLive.map((alias2) => ({ alias: alias2, parked: parkLiveQuery(targetPath, alias2, liveQueries[alias2]) })),
|
|
75079
|
+
app.id
|
|
75080
|
+
);
|
|
74958
75081
|
await writeGeneratedAppFields(
|
|
74959
75082
|
client,
|
|
74960
75083
|
targetPath,
|
|
@@ -75016,6 +75139,7 @@ async function hydrateAppProject(client, targetPath, app, opts) {
|
|
|
75016
75139
|
}
|
|
75017
75140
|
reportUnseenLive("prompt", unseenLiveProse, app.id);
|
|
75018
75141
|
}
|
|
75142
|
+
retireUnboundAliases(targetPath, unbound, new Set(Object.keys(resolved.queries)));
|
|
75019
75143
|
}
|
|
75020
75144
|
async function prepareProjectToolchain(targetPath) {
|
|
75021
75145
|
await runNpmInstall(targetPath);
|
|
@@ -75023,16 +75147,18 @@ async function prepareProjectToolchain(targetPath) {
|
|
|
75023
75147
|
}
|
|
75024
75148
|
async function appPull(client, args) {
|
|
75025
75149
|
const app = await client.getApp(args.app_id);
|
|
75150
|
+
const targetPath = path18.resolve(args.targetPath ?? defaultPullTarget(app.id, app.name));
|
|
75151
|
+
assertNotAnotherAppsCheckout(targetPath, app.id);
|
|
75026
75152
|
if (!app.current_version_id && args.version === void 0) {
|
|
75153
|
+
if (reachedOnlyThroughApi(app)) return pullApiApp(client, app, { targetPath, force: args.force === true });
|
|
75027
75154
|
throw new Error(
|
|
75028
|
-
|
|
75155
|
+
`App ${app.id} has no published version yet. Deploy from another machine first, or use 'lotics app create' to scaffold a new app.`
|
|
75029
75156
|
);
|
|
75030
75157
|
}
|
|
75031
75158
|
const versionId = args.version ?? app.current_version_id;
|
|
75032
75159
|
if (!versionId) throw new Error(`App ${app.id} has no version to pull.`);
|
|
75033
75160
|
const version2 = await client.getAppVersion(app.id, versionId);
|
|
75034
75161
|
const sourceUrl = await client.getAppVersionSourceUrl(app.id, version2.id);
|
|
75035
|
-
const targetPath = path18.resolve(args.targetPath ?? defaultPullTarget(app.id, app.name));
|
|
75036
75162
|
fs17.mkdirSync(targetPath, { recursive: true });
|
|
75037
75163
|
const prior = readPriorStamp(targetPath);
|
|
75038
75164
|
const tmpFile = path18.join(tmpdir(), `lotics-app-${app.id}-${Date.now()}.tar.gz`);
|
|
@@ -75066,7 +75192,7 @@ async function appPull(client, args) {
|
|
|
75066
75192
|
});
|
|
75067
75193
|
await prepareProjectToolchain(targetPath);
|
|
75068
75194
|
reportRestoredFiles(restoredFromArchive, prior !== null);
|
|
75069
|
-
reportKeptLocalFiles(keptLocal, app
|
|
75195
|
+
reportKeptLocalFiles(keptLocal, app, {
|
|
75070
75196
|
// `prior` is non-null whenever the stamp was held — `stampAfterPull` cannot
|
|
75071
75197
|
// hold against nothing — so the fallback only covers the un-held branch,
|
|
75072
75198
|
// which never prints it.
|
|
@@ -75081,6 +75207,41 @@ Ready. Next steps:`);
|
|
|
75081
75207
|
console.error(` # edit src/App.tsx, then:`);
|
|
75082
75208
|
console.error(` lotics app deploy`);
|
|
75083
75209
|
}
|
|
75210
|
+
function assertNotAnotherAppsCheckout(targetPath, appId) {
|
|
75211
|
+
if (!fs17.existsSync(path18.join(targetPath, "package.json"))) return;
|
|
75212
|
+
const holder = readManifest(targetPath).lotics?.app_id;
|
|
75213
|
+
if (typeof holder === "string" && holder !== appId) {
|
|
75214
|
+
throw new Error(
|
|
75215
|
+
`${targetPath} is the project of ${holder}, not ${appId}. Pull ${appId} into its own directory: lotics app pull ${appId} <path>`
|
|
75216
|
+
);
|
|
75217
|
+
}
|
|
75218
|
+
}
|
|
75219
|
+
async function pullApiApp(client, app, args) {
|
|
75220
|
+
const { targetPath } = args;
|
|
75221
|
+
const fresh = !fs17.existsSync(path18.join(targetPath, "package.json"));
|
|
75222
|
+
for (const file2 of buildApiStarterTemplate({ app_name: app.name, app_id: app.id, workspace_id: app.workspace_id })) {
|
|
75223
|
+
const fullPath = path18.join(targetPath, file2.path);
|
|
75224
|
+
if (fs17.existsSync(fullPath)) continue;
|
|
75225
|
+
fs17.mkdirSync(path18.dirname(fullPath), { recursive: true });
|
|
75226
|
+
fs17.writeFileSync(fullPath, file2.content);
|
|
75227
|
+
}
|
|
75228
|
+
const kept = [];
|
|
75229
|
+
await hydrateAppProject(client, targetPath, app, { stamp: { id: null, number: null }, force: args.force, kept });
|
|
75230
|
+
await prepareProjectToolchain(targetPath);
|
|
75231
|
+
reportKeptLocalFiles(kept, app, null);
|
|
75232
|
+
if (fresh) {
|
|
75233
|
+
console.error(
|
|
75234
|
+
`
|
|
75235
|
+
package.json#lotics.writes and .deletes are not on the app, so this fresh project has none: 'lotics app check' holds a body to them only once they are declared.`
|
|
75236
|
+
);
|
|
75237
|
+
}
|
|
75238
|
+
console.error(`
|
|
75239
|
+
Ready \u2014 ${app.name} has no screens; its queries and workflows are its surface. Next steps:`);
|
|
75240
|
+
console.error(` cd ${path18.relative(process.cwd(), targetPath) || "."}`);
|
|
75241
|
+
console.error(` lotics app check # bindings, declarations and bodies against the app`);
|
|
75242
|
+
console.error(` lotics app query set <alias> # publish an edited read`);
|
|
75243
|
+
console.error(` lotics app workflow set <alias> # push an edited body (the server verifies it)`);
|
|
75244
|
+
}
|
|
75084
75245
|
function copyTree(from, to, opts, relative3 = "") {
|
|
75085
75246
|
const kept = [];
|
|
75086
75247
|
const created = [];
|
|
@@ -75118,7 +75279,7 @@ Restored ${restored.length} file${restored.length === 1 ? "" : "s"} the app's la
|
|
|
75118
75279
|
A pull mirrors the last DEPLOYED source, so a file you deleted here comes back until the deletion ships. Delete it again and run 'lotics app deploy' to make it stick.`
|
|
75119
75280
|
);
|
|
75120
75281
|
}
|
|
75121
|
-
function reportKeptLocalFiles(kept,
|
|
75282
|
+
function reportKeptLocalFiles(kept, app, motion) {
|
|
75122
75283
|
if (kept.length === 0) return;
|
|
75123
75284
|
const list3 = kept.slice(0, 20).map((f) => ` \u2022 ${f}`).join("\n") + (kept.length > 20 ? `
|
|
75124
75285
|
\u2026 and ${kept.length - 20} more` : ``);
|
|
@@ -75132,8 +75293,9 @@ ${list3}`;
|
|
|
75132
75293
|
Everything else was refreshed from the app. Your edits are intact` + (motion === null ? `.
|
|
75133
75294
|
` : `, and
|
|
75134
75295
|
this project was already on v${motion.pulled} \u2014 so these are your work, ahead of the app.
|
|
75135
|
-
`) + ` Ship them: lotics app deploy (pushes bodies, prompts and declarations)
|
|
75136
|
-
|
|
75296
|
+
`) + (hasScreens(app) ? ` Ship them: lotics app deploy (pushes bodies, prompts and declarations)
|
|
75297
|
+
` : ` Ship them: lotics app workflow|query|agent set <alias>, one per file
|
|
75298
|
+
`) + ` Take the app's copy: lotics app pull ${app.id} --force (DISCARDS the files above)`
|
|
75137
75299
|
);
|
|
75138
75300
|
return;
|
|
75139
75301
|
}
|
|
@@ -75147,7 +75309,7 @@ ${list3}`;
|
|
|
75147
75309
|
|
|
75148
75310
|
The version stamp was left at v${motion.heldAt} so a deploy from this tree is
|
|
75149
75311
|
REFUSED rather than shipping a half-and-half bundle. To move on, pick one:
|
|
75150
|
-
Take the app's copy: lotics app pull ${
|
|
75312
|
+
Take the app's copy: lotics app pull ${app.id} --force (DISCARDS the files above)
|
|
75151
75313
|
Keep yours: reconcile the files above by hand, then re-run this pull`
|
|
75152
75314
|
);
|
|
75153
75315
|
}
|
|
@@ -77083,7 +77245,7 @@ async function appWorkflowPull(client, args = {}) {
|
|
|
77083
77245
|
`Wrote ${written.length} workflow ${written.length === 1 ? "body" : "bodies"} to ${WORKFLOWS_DIR}/` + (written.length > 0 ? ` (${written.join(", ")})` : "")
|
|
77084
77246
|
);
|
|
77085
77247
|
reportUnchangedBodies(unchanged);
|
|
77086
|
-
reportKeptLocalFiles(kept,
|
|
77248
|
+
reportKeptLocalFiles(kept, app, null);
|
|
77087
77249
|
reportUnseenLive("workflow body", unseenLive, meta3.app_id);
|
|
77088
77250
|
ensureAppTsconfig(projectDir);
|
|
77089
77251
|
}
|
package/docs/building_an_app.md
CHANGED
|
@@ -63,8 +63,8 @@ one devDependency is `typescript`, because `app workflow check` runs the project
|
|
|
63
63
|
Nothing is built and nothing is deployed, so `current_version_id` stays null and the surface goes
|
|
64
64
|
live through `app query set` / `app workflow set` instead. It cannot be combined with `--from`,
|
|
65
65
|
which describes screens; `app dev` and `app check --screens` refuse a project with no Vite
|
|
66
|
-
config, `app deploy` one with no `build` script, and `app pull`
|
|
67
|
-
|
|
66
|
+
config, `app deploy` one with no `build` script, and `app pull` rebuilds its project from the app row,
|
|
67
|
+
since there is no archive. Steps 7 and 8 below do not apply to
|
|
68
68
|
it, and step 9 ships it without a build: `npm run typecheck` (it declares no `lint` and no `test`
|
|
69
69
|
script), `lotics app check` on its own, then `lotics app api publish` where a screens app deploys.
|
|
70
70
|
Every other step applies unchanged.
|
package/docs/cli_reference.md
CHANGED
|
@@ -44,9 +44,9 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
44
44
|
| `lotics knowledge tag <id...> [--add <a,b>] [--remove <c,d>]` | `PATCH /v1/knowledge_docs` with `{ knowledge_doc_ids, add_tags?, remove_tags? }` — one transaction over the whole set. A **DIFF applied to each doc's own labels**, never a replacement: the docs named on one command line carry different labels, so one array across them would strip whatever the others were filed under. Removal matches case-insensitively; adding a label a doc already carries writes nothing. Ids may be separate arguments or comma-separated. At least one of --add/--remove required. |
|
|
45
45
|
| `lotics knowledge hide <id...>` / `lotics knowledge unhide <id...>` | `PATCH /v1/knowledge_docs` with `{ knowledge_doc_ids, hidden }`. Hiding takes docs out of every **listing** — the Library's list, `list_knowledge`, and the corpus `grep_knowledge` searches — while leaving IAM untouched and keeping them readable **by id** (`read_knowledge` with an id, a code run staging one, an app agent's declared set). So it can never silently break an app that depends on a doc, and unhiding costs nothing. Refuses the no-argument form rather than reading it as "everything". |
|
|
46
46
|
| `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. |
|
|
47
|
-
| `lotics app create <name> [path] [--api]` | Scaffold a Vite+React+TS custom-code app project; POST /v1/apps; npm install; vite build; upload as v1. **`--api`** scaffolds an app with NO screens instead: the app's declared queries and workflows are the whole of what it offers, called over HTTP by the customer's own site, server or agent (`POST /v1/apps/{app_id}/queries/{alias}` and `/workflows/{alias}/execute`). It writes `package.json` (the `lotics` block, `typescript` as its only devDependency, `typecheck` as its only script), `tsconfig.json`, the brief in `src/workflows/`, a CI workflow and the two READMEs — no `index.html`, no `src/App.tsx`, no `vite.config.ts`, no kit. Nothing is built and nothing is deployed, so `current_version_id` stays null: `lotics app query set` and `lotics app workflow set` publish each declaration on their own, and `lotics app api publish` snapshots what they promise. The npm registry is not consulted (there is no `@lotics/app-runtime` range to resolve), `npm install` still runs for `typescript` (which `app workflow check` loads), and, for want of a bundle, `app dev` and `app check --screens` (no `vite.config.*`) and `app deploy` (no `build` script) are refused on such a project in one sentence, before a binding is pushed; `app pull`
|
|
47
|
+
| `lotics app create <name> [path] [--api]` | Scaffold a Vite+React+TS custom-code app project; POST /v1/apps; npm install; vite build; upload as v1. **`--api`** scaffolds an app with NO screens instead: the app's declared queries and workflows are the whole of what it offers, called over HTTP by the customer's own site, server or agent (`POST /v1/apps/{app_id}/queries/{alias}` and `/workflows/{alias}/execute`). It writes `package.json` (the `lotics` block, `typescript` as its only devDependency, `typecheck` as its only script), `tsconfig.json`, the brief in `src/workflows/`, a CI workflow and the two READMEs — no `index.html`, no `src/App.tsx`, no `vite.config.ts`, no kit. Nothing is built and nothing is deployed, so `current_version_id` stays null: `lotics app query set` and `lotics app workflow set` publish each declaration on their own, and `lotics app api publish` snapshots what they promise. The npm registry is not consulted (there is no `@lotics/app-runtime` range to resolve), `npm install` still runs for `typescript` (which `app workflow check` loads), and, for want of a bundle, `app dev` and `app check --screens` (no `vite.config.*`) and `app deploy` (no `build` script) are refused on such a project in one sentence, before a binding is pushed; `app pull` rebuilds its project from the app row, since there is no archive to download. `--api` beside `--from` is refused before anything is written — a model's app describes screens. The generated `package.json#name` is the app name FOLDED to ASCII (`Đơn hàng` → `don-hang`), never stripped of it — dropping the marks would treat each accented vowel as a separator and can slug a name away to nothing. The app's display name is unaffected; this is the npm field only. **`--from <model.json>#<app>` builds the app a MODEL states, and it is JSON.** The file is checked as `scaffold check` checks it, the named app (or the only one) is taken, and every entity the app lists, opens or picks is found as the live table this WORKSPACE remembers the alias became — and BY LABEL only for an alias nothing has bound, which is a new entity or a workspace nothing has applied this model to — so a table or a column relabelled since the apply is still the same one, while a bound id the workspace no longer serves is refused by name rather than re-bound to its namesake. A table the workspace lacks is refused first, naming every missing one and `scaffold apply`; then a field a table lacks, a label two tables or two fields share, or a field whose live type is not the model's — all before anything is created. **The app is BOUND to the model's app alias** (`PUT /v1/workspaces/model/binding/apps`) the moment its row exists; an alias already bound to another app is refused before the row is made — `lotics app pull <app_id>` works on that one, `lotics scaffold unbind app <alias>` first makes a new one the model's — and a bound app the workspace no longer holds is refused the same way, never replaced in silence. **What it writes is `app.json`** (version 4): the register — its columns, filters, order, layout and add — the record its rows open — door, sections (each its stage, fields, blocks and the acts at its foot), comment thread — the acts and the checks, and every entity those name with its fields, its `records` statement and the reads and writes over it. Every id in it is live (`tbl_`, `fld_`, `opt_`). Beside it: `src/main.tsx`, which mounts `@lotics/app-runtime` over the spec (and imports `@lotics/app-runtime/sheets` where the register exports), `src/components/index.ts` seeded empty (a `component` block names one there), one `src/workflows/<alias>.ts` per write, and the README. There is no screen source: **the runtime draws the spec**, so a kit correction reaches the app with its next `npm install` rather than with a regeneration. The manifest declares the reads — `<entity>_list` (param `search`), `<entity>_record` (param `<entity>_id`), `<child>_by_<via>` (the parent's id) for each rows or timeline block — `_<field>_<option>` after it for each option a rows block's `where` narrows to — and `<entity>_<field>_pick` where `write_rules` narrow what a link may point at — each carrying the entity's `read_scope` unless the app states `reads: "shared"`; and the writes — `create_<entity>`, `update_<entity>` (only the changed fields; a many-link or files field as `<alias>_added`/`<alias>_removed`), `remove_<entity>`, and `act_<alias>` per act. **Every write re-checks its gates on the server**: required fields, `min`/`max`, `options_where`, `read_scope`, a `natural_key` match reused rather than duplicated, `default_from`, an act's `when` and `requires`, the checks blocking it, and the status `history` row a move appends. An act that names its own `workflow` gets that file with a generated guard region at its top, between `// <lotics:guards>` and `// </lotics:guards>`; the code below is yours. **And it declares what the app WRITES** — `package.json#lotics.writes`, table alias → the field aliases its workflows change — **and what it DELETES**, `package.json#lotics.deletes`. Seeded once: from then on the declaration is the app's, and `app check` refuses a body that writes or deletes outside it. |
|
|
48
48
|
| `lotics app regenerate [--from <model.json>#<app>] [--dry-run] [--bind-new] [--screens]` | **Recompile an app that already exists from its model, and rewrite what the generator owns.** Run inside the app directory. The model is whatever `package.json#lotics.plan` remembers — written there by `app create --from` and by this command — unless `--from` names another, which is then remembered in its place; no model and no flag is a refusal, as is a directory with no `lotics.app_id`, a model that does not check (every finding printed), and a model that names no such app. It resolves against the LIVE workspace through the same function `app create --from` resolves with, so the refusals and the output are that command's. **Files. The generator owns what it emits.** `app.json` is compiled from the model and rewritten whole — there is nothing in a spec to merge — the entry beside it never varies, and a generated workflow body is the generator's too: what it replaced goes into `.lotics/regenerate-dropped.patch`, file by file, rather than into a three-way merge, because a conflict marker inside a body is a file the server has to parse. A body is compared as its BODY, since `app codegen` wraps every one on disk in the header and `__workflow` envelope the server verifies against, so comparing bytes would read that wrapper as your edit on every app. **Two things are the author's.** `src/components/` is seeded where it is absent, named back where you have changed it, and never rewritten. An act's own `workflow` keeps your code: only its guard region, between `// <lotics:guards>` and `// </lotics:guards>`, is rewritten, and a body carrying those markers is never deleted as retired. A body whose alias the generator has retired is deleted. **Manifest.** `.lotics/generated/manifest.json` records the alias sets each generation declared, and that is what the reconciliation reads: queries and workflow declarations the generator emits replace their counterparts (each `workflow_id` carried over — the server minted it), aliases the last generation emitted and this one does not are removed and listed, and aliases you added by hand are kept. `lotics.writes` gains the generator's columns and `lotics.deletes` its tables, and each loses an entry on two facts only, each named in the summary: a column the live table no longer carries, and one nothing in the app WRITES any more (a delete retires on the second rule alone — it names no column for a rename to strand) (the bodies it holds after the run, plus this generation's own declaration — a column a screen only READS is not a write, and `app check` can never find one, because a declaration covering more than the bodies write refuses nothing). A body the subset refuses, or one calling a tool this CLI's registry does not know, suspends that second rule for the run: nothing is dropped on a guess. **It pushes NOTHING.** What the live app RUNS changes at `lotics app deploy` and nowhere else, because the bundle production serves was built against the bindings it has: a regeneration that replaced a live workflow body or a live picker query left a deployed create dialog posting inputs its workflow no longer declared, and a picker answering nothing. Instead the summary NAMES what a deploy will do to the live app — `add` for an alias it does not have, `change` for one this tree is ahead of, `remove` for one the generator retired that this checkout bound and the app still serves (the next deploy unbinds it; the retirement is recorded in `.lotics/generated/manifest.json` until one does) — read through the same detector `app check` reports from and `app deploy` pushes from, so the preview cannot disagree with the deploy. **`--bind-new`** is the one live effect left: it binds the aliases the app does not have YET and refuses, naming them, to touch one that already exists, because `lotics app dev` forwards its queries to production and a new alias cannot be exercised until something binds it, while adding one the deployed bundle never calls cannot change what that bundle does. **The runtime follows the spec.** The spec is written for the `@lotics/app-runtime` line this CLI generates for, so the directory's `@lotics/app-runtime` moves to the runtime's latest line and a `@lotics/ui` the app lists to the range that runtime depends on, in one install, and the summary names each move; a range already on its line is left as written, an app still listing `@lotics/app-sdk` is migrated as `lotics app kit --published` migrates it, and a runtime installed from a checkout (`lotics app kit`) is left and named. The model app's icon and colour are compared with the live app's and a difference is named — `workspace build` sets it, since this command changes nothing live. Then `app codegen` runs, the summary prints — files written / kept / deleted, what a deploy will change, what was bound ahead, and `lotics app deploy` as the next command — and the fast `app check` runs (`--screens` passes through), with the bindings this run deliberately left ahead reported by the summary rather than failed by the check. `--dry-run` decides the whole run, prints it, and writes nothing: not a file, not a binding; it cannot be combined with `--bind-new`. |
|
|
49
|
-
| `lotics app pull <app_id> [path]` | Download source archive from R2 (presigned), extract, install dependencies (`npm ci --ignore-scripts` when a lockfile is present, else `npm install --ignore-scripts`), 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. **A pull never overwrites a file that differs from what it is about to write** — it writes only what is ABSENT or already identical, keeps the rest, and reports which files it kept plus the commands that close the gap. The same rule covers `src/workflows/<alias>.ts
|
|
49
|
+
| `lotics app pull <app_id> [path]` | Download source archive from R2 (presigned), extract, install dependencies (`npm ci --ignore-scripts` when a lockfile is present, else `npm install --ignore-scripts`), 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. A target whose manifest names ANOTHER app is refused before anything is written. **A pull never overwrites a file that differs from what it is about to write** — it writes only what is ABSENT or already identical, keeps the rest, and reports which files it kept plus the commands that close the gap. The same rule covers `src/workflows/<alias>.ts`, `src/agents/<alias>.md` and each `package.json#lotics.queries.<alias>`, so an unpushed body, prompt or query survives too. Those two are written from the LIVE App row (`apps.workflows` / `apps.agents`), which owns them, and the archive's own copy of them is deliberately SKIPPED on extract: a deploy tars the whole source directory, so the tarball holds a deploy-time snapshot that is stale for anything authored since. The comparison is against the app's own content, not git, so it holds for a project that was never a repo. `--force` takes the app's copy and DISCARDS local edits; there is no other way to lose them. **For a KEPT workflow body, agent prompt or query the pull records the server's fingerprint only when the server has not moved** — that token is `set_app_workflow`/`set_app_agent`'s lost-update precondition, so recording one for text the author has not seen would clear the next push's refusal by disarming the guard, and silently overwrite whoever edited it. When the live text HAS moved, the pull writes it beside the checkout (`.lotics/agents/<alias>.live.md`, `.lotics/workflows/<alias>.live.ts`, `.lotics/queries/<alias>.live.json`), names it, and leaves the token stale: the next deploy is refused, which is correct, and the text to merge is now on disk. A file whose prose/body already reads back AS the live text is never "kept" at all — the baselines are healed from it, so a checkout whose prose was pushed out of band (chat, `lotics run set_app_agent`) converges instead of latching. **A pull also REPORTS the files it restored** when refreshing a tree that already claimed a version: a pull mirrors the last DEPLOYED source, so a file deleted locally comes back until the deletion itself ships, and saying so is the only honest fix — nothing can read a deletion off the disk. **When a pull ACROSS versions keeps files, the manifest is left on the OLDER of the two versions** — the tree is then part one and part the other, and claiming the newer would make `deploy`'s `prev_version_id` check pass and ship a half-and-half bundle. Older, not "the one it had": `--from-version` pulls a deliberately old revision, so the version it had is the NEWER side, and holding that would match what the server serves and let the old source ship. Either way a deploy from that tree is refused until you reconcile the listed files by hand and pull again, or take the app's copy with `--force`. The report says which version each side is on, because a kept file is your unshipped work when the project was already current and merely the OLD version when it was behind — and nothing in a byte comparison can tell those apart. **`--from-version <apv_…>`** pulls an OLDER revision instead of the current one (`lotics app versions` lists the ids) — point it at a NEW path to read a previous revision without disturbing the project you are in. The manifest records the version actually written, never the live pointer, so a deploy from that checkout is refused by the version guard rather than shipping old source over newer. — `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 — AFTER `npm install`, so `node_modules/@lotics/ui` actually exists to read — `.lotics/tsconfig.link.json`'s peer pins and, for a kit old enough to ship one, its `react-native` augmentation (a kit that ships none has the previously-written copy deleted); a pulled project's own `tsc` used to fail until `app codegen` was run by hand, because nothing had regenerated either one after install populated node_modules. AND the runtime `.lotics/app_fields.ts` (the same generation `app codegen` runs, off the app row already fetched). 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. 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 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`. **What the app retired leaves the checkout:** a workflow body or agent prompt whose alias the app no longer binds is deleted with its baseline (and a workflow's `.lotics/workflows/<alias>.globals.d.ts`) when it is unedited since this checkout last synced it; one edited since, or never synced, is kept and named — and one authored here and never pushed keeps its `package.json#lotics.workflows`/`agents` declaration, which the live row has nothing to restamp from — and `--force` takes the app's shape. Every other stale `.lotics/` companion is `app codegen`'s to reconcile. **An app with no screens (`app create --api`) has no archive**: its queries, workflow bodies and agents all live on its row, so the pull writes the `--api` scaffold where a file is missing and hydrates the rest from the row — into an empty directory or over a checkout that has fallen behind, by the same keep-your-edits rule. `package.json#lotics.writes` and `.deletes` are the one declaration the row does not hold: a checkout keeps its own, and a fresh one starts without them. 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. A pull writes it from live UNLESS the local file holds unpushed work, in which case it is kept and the live text is parked beside the checkout — the same rule the rest of this row describes. 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_tier`/…) — 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 |
|
|
50
50
|
| `lotics app deploy [--prune] [--prune-invoked <alias>] [-m <message>] [--acknowledge-breaking-api]` | `-m` is OPTIONAL — omitted, the deploy derives the version message from what it pushed. Runs the app's `npm run typecheck` and `npm run build`, tars source + dist, POST /v1/apps/{id}/versions multipart. **One command ships everything.** Before the bundle moves it 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. **Every query and workflow in that set is asked before the first one moves** — a query through the server's own query gate over the fields `get_table` serves, a body through `set_app_workflow` with `verify_only` — and one that would be refused refuses the whole push, naming each refusal in the server's words: the bindings replace aliases the running bundle calls, so a push stopped half way leaves the live app reading a mix. What cannot be asked (a table unreadable to this credential, a server without `verify_only`) is warned and pushed. 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` rides that push and is compared against the recorded baseline, not the live app — it lives on the workflow ROW, which `getApp` does not carry. Editing `lotics.agents.<alias>.inputs`/`outputs` is pushed the same way, and only those two fields (`set_app_agent` merges, so anything the manifest does not model is left untouched). The deploy never AUTHORS a binding itself, 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. It regenerates the `.lotics/*.d.ts` companions and `.lotics/app_fields.ts` before building — the build INLINES the latter — and then typechecks against them; a `package.json` with no `typecheck` script is warned about, never passed in silence. `lotics app check` reports the same set without pushing; neither has a `--strict`. The aliases the version RECORDS as called — the set `remove_app_workflow` / `remove_app_query` / `remove_app_agent` consult to refuse unbinding one the served version still reaches — are read by the SERVER out of the uploaded source archive, never reported by the client that is also what unbinds. **After the ship it unbinds what the GENERATOR retired, unasked**: an alias `.lotics/generated/manifest.json` records as retired by `app regenerate` that this checkout bound and no longer declares — the same transition rule as below, so an alias another checkout bound, or one declared again by hand, is never touched. Every unbind — this one and `--prune`'s — carries the fingerprint the project last saw live, so an alias rewritten since (by chat, by another checkout) is refused and left bound, and a retired one is then dropped from the record, named. Beside that fingerprint alone the invocation guard is lifted, since the recorded runs are then the generated app's own calls to a body nobody rewrote; one that will not unbind for any other reason stays recorded and the next deploy retries it. **Beyond those it reports two things and removes nothing.** Aliases the source CALLS that nothing bound. And bindings this project has RETIRED, which is two transitions, each with its own evidence: an alias the previous bundle called and this one does not (`package.json#lotics.bundle_calls`, recorded by each deploy), and an alias still bound live that this checkout holds a `lotics.synced.<kind>.<alias>` baseline for and no longer DECLARES. Neither piece of evidence present is an alias this checkout has never seen — bound by chat, by another operator, or after this tree was pulled — which is not a removal and is never a prune target. With no `bundle_calls` the first transition reports nothing; that deploy records it and the next can compare. The `bundle_calls` baseline is STICKY: it advances only once the call-site half is settled, so the `--prune` a warning names still finds the transition on a later run. **`--prune` unbinds them, and only when passed.** It runs AFTER the version is live, because the removal tools refuse an alias the SERVED version still declares. When the source computes an alias at run time, the call-site half is left in place with a warning (the scan cannot tell which binding that call reaches); the declaration-removed half is unbound anyway, since deleting a declaration here states the removal outright. A removal DELETES the local declaration too — `package.json#lotics.<kind>.<alias>` and its `synced` baseline — or the next plain deploy would push it straight back; what it deleted is written to `.lotics/pruned/<kind>/<alias>.json` and the ✓ names that file plus the `set` verb that re-binds it. (These trees are never committed, so `lotics app pull --from-version <apv_…>` is the only other route back.) The generated companions are then regenerated from the narrowed manifest; a table named ONLY by a pruned query leaves `F`/`OPT`, which is reported — a workflow that still writes it keeps it, since the codegen set is the queries' tables plus every bound workflow's own `table_ids`. A binding that will not unbind is reported and never fails the release, and neither does a local write that fails: the version is already live, and the report names which aliases were unbound server-side. The server refuses to unbind a WORKFLOW this workspace has actually run — a recorded execution means a caller the source cannot name — printed as `✗ could not unbind …` with the date it last ran. **`--prune-invoked <alias>` lifts that guard for the alias you name** (repeatable, comma-separated; needs `--prune`, and is refused as a no-op without it), keeping the prune's report, undo file and manifest cleanup that a raw `lotics run remove_app_workflow` loses. Finally it refreshes `.lotics/workflows/<alias>.globals.d.ts` for any alias whose `// lotics:declaration` stamp says this deploy moved its declaration — from the manifest, re-wrapping the SAME on-disk body, so local edits survive. Non-fatal: the release has shipped, and stale types never fail it. **`--acknowledge-breaking-api`** carries this write out even though it breaks what the app's published API promises, snapshotting the broken contract as a new version; without it such a write is refused and every breaking change is named (see `app api`). It rides every write the release makes — the bindings pushed ahead of the bundle, the version itself, and a `--prune`'s unbinds — because the answer is about the RELEASE. |
|
|
51
51
|
| `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. Server-side it is the app's owner or an org admin, the same gate deploy and source download take — a `manager` share on somebody else's app does not reach it. Answers "what shipped, when, by whom" — e.g. whether a fix was live at an incident's time. Title → stderr, table → stdout (pipeable). |
|
|
52
52
|
| `lotics app upgrade [app_id] [--connection <alias>=<cac_id> ...]` | `POST /v1/apps/{id}/upgrade` — apply the latest version of the package this app was COPIED from. A copy records its provenance (`apps.origin`: package, version, app alias and the `bind` it was made under) and this is the only thing that reads it — a hand-built app, or one copied before the column existed, has no package to offer one and answers 400. Run it once per app: a package's apps each carry their own provenance. **The schema is additive** — fields, options and views the new version declares are created under the recorded bind, so they land on the same tables the copy did; nothing is renamed, retyped or deleted, and a field the new version stopped declaring keeps its column and its data and is REPORTED. **An artifact is replaced only while it is still byte-for-byte what was delivered**: a workflow or agent you have edited here is kept as it is and named, so the offer is partial by design and every part it declined to touch is printed. Queries are replaced outright (generated from the contract, no edit to lose) and only a knowledge doc the new version ADDS is created. The app is then redeployed from the new version's prebuilt dist — **nothing local is read or sent**, so a checkout on this machine is behind afterwards and the report ends at `lotics app pull <app_id>`. app_id from the local manifest, or pass one to upgrade any app without pulling it. **Already on the latest version prints that one line and exits 0** — it is a refusal before the first write, not a failure, and re-applying the version it is on would re-stamp your edits as delivered. Every other refusal (an unpublished package, a contract that no longer validates, a bind the new version broke) is a package that cannot be applied: the app is untouched, the server's sentence is printed, and the exit is 1. Anything else — no provenance to read, not an admin, no such app — exits 1. Admin-only. Audited as `app.upgrade`. **`--acknowledge-breaking-api`** carries this write out even though it breaks what the app's published API promises, snapshotting the broken contract as a new version; without it such a write is refused and every breaking change is named (see `app api`). **`--connection <alias>=<cac_id>`** (repeatable) names the account a connection pushes through, where you can use more than one account of its provider — two accounts of one service are two sets of books, so the refusal that asks for it names each and nothing is ever picked for you; the account must be this workspace's, of the provider the model declares, and one you can use. |
|
|
@@ -68,7 +68,7 @@ Per-command syntax, flags, contracts, and gotchas for the public `lotics` CLI. S
|
|
|
68
68
|
| `lotics docs` \| `lotics docs <area>[/<section>]` | The index of the reference docs, **resolved out of the packages installed beside this project** — the model reference alone is carried by this CLI (`lotics docs model`). **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-runtime`, `@lotics/ui` and `@lotics/cli` sort first as a reading ORDER, not a filter. **Output is ONE PAGE, 16 KB, navigation included**: a doc that does not fit prints its opening and the addresses that reach into it — its sections with their sizes, or, for a reference that is one table (this file, the kit's catalog), the name of every row. `lotics docs <area>/<section>` prints that section, a path of sections (`model/field/select`) finds each inside the one before, and `lotics docs ui/catalog/Button` that one row; a unique prefix is enough, and an address matching two parts is refused with both. Both levels 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; 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. |
|
|
69
69
|
| `lotics docs model` \| `lotics docs model/<section>[/…]` | **The model reference, from inside the binary** — the one doc this CLI carries rather than resolves, because it describes this CLI's own model checker; listed first by `lotics docs`, at this CLI's version. Its first page is what a model composes with, the working order (jobs → entities and fields → `records` → one app per job → `scaffold check` → `app preview` → `workspace build`) and the section addresses; every page of it is whole. Every top-level key of a `model.json`, every field `type` the contract admits with the config each one needs, the option / view / role / inline-template shapes, `records` (how a row of each entity is recognised), `write_rules`, `apps` (each register, record, act and check), the row format (relative dates `@today` / `@month-start` with whole-day offsets; links as `"<entity-alias>:<ref>"`), the rules, the `apply` list (packages copied in after the model's own tables, each with an optional `bind` onto them), the `preset` block (a published model's branches and its at-most-two questions), the **`from` form** — `{from, variants, rename, entities, rows, records, write_rules, apps, apply}`, which names a preset by SLUG instead of restating it — and one complete worked example. **Offline, no account.** |
|
|
70
70
|
| `lotics report '<json>'` \| `lotics report @report.json` | File a report with the Lotics team about what got in your way. **Covers the classes telemetry structurally cannot see**: a capability that does not exist (no command ran, so nothing was recorded), a command that exited 0 having done the wrong thing, an error whose message did not name the remedy, and anything that made authoring slower than it should be. **A frame, not a paragraph** — `{goal, actual, expected?, tried?, wanted?}`, `goal` and `actual` required, unknown keys dropped rather than refused. **No severity or category.** Ingest is inline JSON, `@file`, or `-` for stdin. A bare sentence is refused with the frame printed beside it, so the fix is one step; a bare invocation prints the frame BEFORE asking for a credential, since someone whose key will not resolve is exactly who has something to report. **Not spooled**: unlike telemetry it posts inline, prints whether it landed, and exits non-zero if it did not, echoing the report back so a failed send never loses it. Runs regardless of `LOTICS_TELEMETRY` — invoking it IS the consent that passive collection needs an opt-in for — but with telemetry off there are no recorded commands to attach, and it says so rather than implying context it does not have. Requires auth. Never paste records, file contents, or credentials. **Prints the id of each frame filed** — a filing nobody can cite cannot be answered about. The ids come from the server, so an instance that only logs the frames prints the count alone; the CLI never mints one of its own, which would hand back a token that resolves to nothing. |
|
|
71
|
-
| `lotics app check` | Every pre-flight `deploy` runs, WITHOUT building or shipping. **First, whether this project is even based on the served version** — the one thing a deploy REFUSES outright rather than pushing (the server 409s a stale `prev_version_id`), and the one finding that invalidates every other: a stale tree and the live app are two different apps, so comparing them reports nothing trustworthy. Stale exits 1 naming both versions and stops before the rest; a project with no stamp at all — or an app with no version yet — is a first deploy, not a conflict. `deploy` runs the SAME assertion, so a stale tree fails before it pushes or builds. Then: the manifest's agent schemas against the live app row, every binding a deploy would push, aliases the source calls that nothing bound (queries, workflows AND agents), bindings this bundle stopped calling (the same transition — and the same baseline — `deploy` reports, so the two cannot disagree), capability-gated SDK calls the manifest doesn't declare, a missing icon/theme, a missing app `description` (it heads the capability catalog the chat agent reads every turn, and its absence has no other symptom), a `vite.config.ts` that never defines `global`/`__DEV__` **in a project that still ships react-native** (read off its own `package.json` — an app on the React DOM kit bundles none of it and the check would be advice to define two globals nothing reads), and a `window.open` in the app's own source (each fails ONLY in the deployed app: dev bundles with esbuild and production with rollup, so typecheck, lint, build and `app dev` are all green), an agent whose capability and its reach disagree, in EITHER direction, over any of the five declaration-bound tools (`run_app_query`/`run_app_workflow` against `query_aliases`/`workflow_aliases`; `grep_knowledge`/`read_knowledge`/`list_knowledge` against `knowledge_doc_ids`) — the tool is the capability, the list is the reach, and a tool with no reach means every call it makes is refused while the run still COMPLETES, so it surfaces as a model ignoring its prompt; read off the live row, never the manifest, which mirrors those fields but is pushed by no verb, and a notice for any alias the source computes at runtime (invisible to every check here and to `--prune`'s unbind guard). **And whether the runtime this app builds against has fallen behind what is published** — `@lotics/app-runtime` alone, since the kit an app lists sits at the runtime's range, read from `node_modules` rather than the range because a caret is minor-locked below 1.0 (`^0.13.x` can never resolve `0.14`, and `npm update` does nothing). A release LINE behind is loud and names `lotics app kit --published` and `@lotics/ui`'s `MIGRATION.md`; anything smaller is one quiet `npm update` line, because a warning that fires on every deploy is one the reader stops seeing. An app still listing `@lotics/app-sdk` is told it moved into the runtime and which verb migrates it. The lookup is bounded and every failure is silence: a version check must never become a new way for a deploy to fail. Every deploy finding is the same helper `deploy` calls, so a green check means a deploy will not complain. **And the PORTABILITY gate, the second of two rules `check` runs that a deploy does not** (the first is the undeclared call site below) — the ids an app cannot carry into another workspace, over the working tree, with the same exclusions the deploy tar applies. Two rules. **An id this workspace MINTED**, written into `src/`, a `.md` or the app's own docs — it resolves to nothing in a copy, and in prose it is an instruction the copier's agent follows; this is the one a `library publish` also refuses, on the uploaded archive. **And an id-shaped STAND-IN** too short for the generator that mints its prefix (`"opt_X"`, `"fld_a"` — quoted or in a code span, so a bare `opt_in` stays legal, and never in a test file), which only `check` runs, and which additionally reads a workflow body and the manifest: those two are exempt from the first rule because a publish INVERTS a real id there and cannot invert a fake. **And an `app_` id anywhere in `app.json`**: the spec names no other app, so a pasted one is re-pointed by nothing. Each is reported as `<file>:<line> — <id>` with the one edit that fixes it. This gate reads only the files, but the command around it still needs a resolvable credential and the live app row, so it is not an offline check. **And every bound workflow body, checked as `app workflow check` checks it** — the same isolated per-alias program against the pulled `.lotics/workflows/<alias>.globals.d.ts`, then the server's `verify_only` verdict on each body that passed — and on each body no local pass could type (no globals, no `typescript`), since that is what a push would meet — which exits 1 on any issue and warns when the server is not reached. The server verifies a body once, at the save that wrote it, so a body whose declared types have since moved stays stored, matching what is live, and is refused by the next writer — a starter copy, in somebody else's workspace. The verdict is as fresh as those types, which `pull`, `workflow pull` and `codegen` refresh. **And the app's own `npm run typecheck`**, after regenerating the `.lotics/*.d.ts` companions from the manifest — the same run a deploy makes before building, so a filter or sort key the query does not project fails here rather than at the first member's request. **Exits 1 on that, on a body the types refuse, on a failing typecheck, and on what a `deploy` would REFUSE or PUSH** — an agent schema that disagrees with the live app, any binding the project has ahead of the app (an edited workflow body or declaration, edited agent prose, a changed query), **every manifest query the server would refuse** — held to the server's own query gate (the declaration, each query it runs as, the tables it reads through `get_table`, its filters and the columns it outputs; the owner's reach and the SQL compile stay the server's), in the server's words — and a query or workflow `description` over the 300-character capability cap, which is a binding no `set` and no deploy will take (the rule is `@lotics/shared`'s, the same one the server refuses with, and `workflow set` / `query set` ask it before sending anything — so a long line costs one edit rather than a failed push per alias). **And every manifest query declared with NO description**, named in one line: that sentence is what a chat or MCP caller chooses between aliases by, and an alias is a JS identifier. `app create --from` deliberately writes none — a template over a shape's own English reads like a line about the business while saying nothing — so a generated app is told once, here, which lines are the author's to write. Both are things a deploy would act on, so CI gating on a green check means a deploy has nothing left to do; genuine advisories (capabilities, branding, a runtime-computed alias, orphaned bindings) stay advisory and never fail it. **`--screens` adds the rendered surface, and is its own entry below.** It runs after the typecheck and only when it passed — a type error renders nothing to measure — and its findings, and any write it refused, fold into this command's exit code. **It also refuses a call site the manifest no longer declares.** `useQuery`/`useWorkflow` keep a bare-string overload for a computed alias, so deleting or renaming an alias leaves every call site compiling and failing only when the screen renders — the one edit most likely to orphan a call site is the one the generated types cannot catch. The alias literals in `src/` are matched against `package.json#lotics.queries`/`.workflows` (the manifest, not the live row: the server still SERVES an alias whose declaration was just deleted, because a deploy never unbinds), and an undeclared one exits 1. `app codegen` prints the same finding as a warning, since it is the command an author runs right after editing the manifest. **A failing body that is byte-identical to the one the server is running is labelled as such**: its `lotics.synced.workflows.<alias>.content` baseline proves the file has not been edited since it was pushed or pulled, so the failure is a grammar migration the stored body is owed rather than a stale checkout — a link field reads as an id array, so drop `.id` or descend with `linked(…)`. Until the body is edited and `set`, the stored one keeps running as it always has. **And a query that reads past a table's ROW RULE.** A table's `private_filters` bind the CALLER, and an app query's caller is the app's OWNER — the viewer needs no table access, `app:use` is the grant — so the rule passes and every row is served. For each table a declared query reads (`GET /v1/tables/{id}`, the one surface that serves the rule), the viewer predicate — `current_member in_any_group`, or a member field's `is_current_member` / `is_not_current_member` — is attributed to the SCAN it guards: a `from_table`'s own `filter`, or an enclosing `filter` node's predicate, whose rows are the ones that scan produced. So a clause written over one table never silences the finding for the ruled table joined beside it, and every scan no clause covers is named with its table. A table this credential may not read (403, or 404 for one that is gone) is dropped — a rule that cannot be read is not evidence of one — while any other failure of that read fails the command, since "I could not ask" must never render as "there is no rule". Advisory, never part of the exit code: an app that deliberately serves the whole table to a desk of people who may all read it is legitimate, and nothing here can tell the two apart. **And it names the workflows a chat or MCP caller is offered with no description** (one `get_app_capabilities` read, the reader's own view of the app): that text is what those callers choose between aliases by, and without it they choose by the alias. It cannot be counted from the manifest — a workflow bound out of band is not declared there at all. Advisory, never part of the exit code. **It regenerates `.lotics/app_fields.ts` from the live schema before typechecking**, as a deploy does — a gitignored map from a moved schema otherwise passes. **And three claims the app makes**: a bound body's writes against `package.json#lotics.writes`, read as the step tree the server would store, exit 1 on a field no entry covers, and declaring none only warns; a description carrying `<placeholder>` syntax exits 1, since the catalogue escapes angle brackets — state the format as an example; so does one naming a desk `query_apps` does not list. |
|
|
71
|
+
| `lotics app check` | Every pre-flight `deploy` runs, WITHOUT building or shipping. **First, whether this project is even based on the served version** — the one thing a deploy REFUSES outright rather than pushing (the server 409s a stale `prev_version_id`), and the one finding that invalidates every other: a stale tree and the live app are two different apps, so comparing them reports nothing trustworthy. Stale exits 1 naming both versions and stops before the rest; a project with no stamp at all — or an app with no version yet — is a first deploy, not a conflict. `deploy` runs the SAME assertion, so a stale tree fails before it pushes or builds. Then: the manifest's agent schemas against the live app row, every binding a deploy would push, aliases the source calls that nothing bound (queries, workflows AND agents), bindings this bundle stopped calling (the same transition — and the same baseline — `deploy` reports, so the two cannot disagree), capability-gated SDK calls the manifest doesn't declare, a missing icon/theme, a missing app `description` (it heads the capability catalog the chat agent reads every turn, and its absence has no other symptom), a `vite.config.ts` that never defines `global`/`__DEV__` **in a project that still ships react-native** (read off its own `package.json` — an app on the React DOM kit bundles none of it and the check would be advice to define two globals nothing reads), and a `window.open` in the app's own source (each fails ONLY in the deployed app: dev bundles with esbuild and production with rollup, so typecheck, lint, build and `app dev` are all green), an agent whose capability and its reach disagree, in EITHER direction, over any of the five declaration-bound tools (`run_app_query`/`run_app_workflow` against `query_aliases`/`workflow_aliases`; `grep_knowledge`/`read_knowledge`/`list_knowledge` against `knowledge_doc_ids`) — the tool is the capability, the list is the reach, and a tool with no reach means every call it makes is refused while the run still COMPLETES, so it surfaces as a model ignoring its prompt; read off the live row, never the manifest, which mirrors those fields but is pushed by no verb, and a notice for any alias the source computes at runtime (invisible to every check here and to `--prune`'s unbind guard). **And whether the runtime this app builds against has fallen behind what is published** — `@lotics/app-runtime` alone, since the kit an app lists sits at the runtime's range, read from `node_modules` rather than the range because a caret is minor-locked below 1.0 (`^0.13.x` can never resolve `0.14`, and `npm update` does nothing). A release LINE behind is loud and names `lotics app kit --published` and `@lotics/ui`'s `MIGRATION.md`; anything smaller is one quiet `npm update` line, because a warning that fires on every deploy is one the reader stops seeing. An app still listing `@lotics/app-sdk` is told it moved into the runtime and which verb migrates it. The lookup is bounded and every failure is silence: a version check must never become a new way for a deploy to fail. Every deploy finding is the same helper `deploy` calls, so a green check means a deploy will not complain. **And the PORTABILITY gate, one of three rules `check` runs that a deploy does not** (the others are the undeclared call site below and `package.json#lotics.writes`/`deletes`, held against what every workflow body writes and deletes) — the ids an app cannot carry into another workspace, over the working tree, with the same exclusions the deploy tar applies. Two rules. **An id this workspace MINTED**, written into `src/`, a `.md` or the app's own docs — it resolves to nothing in a copy, and in prose it is an instruction the copier's agent follows; this is the one a `library publish` also refuses, on the uploaded archive. **And an id-shaped STAND-IN** too short for the generator that mints its prefix (`"opt_X"`, `"fld_a"` — quoted or in a code span, so a bare `opt_in` stays legal, and never in a test file), which only `check` runs, and which additionally reads a workflow body and the manifest: those two are exempt from the first rule because a publish INVERTS a real id there and cannot invert a fake. **And an `app_` id anywhere in `app.json`**: the spec names no other app, so a pasted one is re-pointed by nothing. Each is reported as `<file>:<line> — <id>` with the one edit that fixes it. This gate reads only the files, but the command around it still needs a resolvable credential and the live app row, so it is not an offline check. **And every bound workflow body, checked as `app workflow check` checks it** — the same isolated per-alias program against the pulled `.lotics/workflows/<alias>.globals.d.ts`, then the server's `verify_only` verdict on each body that passed — and on each body no local pass could type (no globals, no `typescript`), since that is what a push would meet — which exits 1 on any issue and warns when the server is not reached. The server verifies a body once, at the save that wrote it, so a body whose declared types have since moved stays stored, matching what is live, and is refused by the next writer — a starter copy, in somebody else's workspace. The verdict is as fresh as those types, which `pull`, `workflow pull` and `codegen` refresh. **And the app's own `npm run typecheck`**, after regenerating the `.lotics/*.d.ts` companions from the manifest — the same run a deploy makes before building, so a filter or sort key the query does not project fails here rather than at the first member's request. **Exits 1 on that, on a body the types refuse, on a failing typecheck, and on what a `deploy` would REFUSE or PUSH** — an agent schema that disagrees with the live app, any binding the project has ahead of the app (an edited workflow body or declaration, edited agent prose, a changed query), **every manifest query the server would refuse** — held to the server's own query gate (the declaration, each query it runs as, the tables it reads through `get_table`, its filters and the columns it outputs; the owner's reach and the SQL compile stay the server's), in the server's words — and a query or workflow `description` over the 300-character capability cap, which is a binding no `set` and no deploy will take (the rule is `@lotics/shared`'s, the same one the server refuses with, and `workflow set` / `query set` ask it before sending anything — so a long line costs one edit rather than a failed push per alias). **And every manifest query declared with NO description**, named in one line: that sentence is what a chat or MCP caller chooses between aliases by, and an alias is a JS identifier. `app create --from` deliberately writes none — a template over a shape's own English reads like a line about the business while saying nothing — so a generated app is told once, here, which lines are the author's to write. Both are things a deploy would act on, so CI gating on a green check means a deploy has nothing left to do; genuine advisories (capabilities, branding, a runtime-computed alias, orphaned bindings) stay advisory and never fail it. **`--screens` adds the rendered surface, and is its own entry below.** It runs after the typecheck and only when it passed — a type error renders nothing to measure — and its findings, and any write it refused, fold into this command's exit code. **It also refuses a call site the manifest no longer declares.** `useQuery`/`useWorkflow` keep a bare-string overload for a computed alias, so deleting or renaming an alias leaves every call site compiling and failing only when the screen renders — the one edit most likely to orphan a call site is the one the generated types cannot catch. The alias literals in `src/` are matched against `package.json#lotics.queries`/`.workflows` (the manifest, not the live row: the server still SERVES an alias whose declaration was just deleted, because a deploy never unbinds), and an undeclared one exits 1. `app codegen` prints the same finding as a warning, since it is the command an author runs right after editing the manifest. **A failing body that is byte-identical to the one the server is running is labelled as such**: its `lotics.synced.workflows.<alias>.content` baseline proves the file has not been edited since it was pushed or pulled, so the failure is a grammar migration the stored body is owed rather than a stale checkout — a link field reads as an id array, so drop `.id` or descend with `linked(…)`. Until the body is edited and `set`, the stored one keeps running as it always has. **And a query that reads past a table's ROW RULE.** A table's `private_filters` bind the CALLER, and an app query's caller is the app's OWNER — the viewer needs no table access, `app:use` is the grant — so the rule passes and every row is served. For each table a declared query reads (`GET /v1/tables/{id}`, the one surface that serves the rule), the viewer predicate — `current_member in_any_group`, or a member field's `is_current_member` / `is_not_current_member` — is attributed to the SCAN it guards: a `from_table`'s own `filter`, or an enclosing `filter` node's predicate, whose rows are the ones that scan produced. So a clause written over one table never silences the finding for the ruled table joined beside it, and every scan no clause covers is named with its table. A table this credential may not read (403, or 404 for one that is gone) is dropped — a rule that cannot be read is not evidence of one — while any other failure of that read fails the command, since "I could not ask" must never render as "there is no rule". Advisory, never part of the exit code: an app that deliberately serves the whole table to a desk of people who may all read it is legitimate, and nothing here can tell the two apart. **And it names the workflows a chat or MCP caller is offered with no description** (one `get_app_capabilities` read, the reader's own view of the app): that text is what those callers choose between aliases by, and without it they choose by the alias. It cannot be counted from the manifest — a workflow bound out of band is not declared there at all. Advisory, never part of the exit code. **It regenerates `.lotics/app_fields.ts` from the live schema before typechecking**, as a deploy does — a gitignored map from a moved schema otherwise passes. **And three claims the app makes**: a bound body's writes against `package.json#lotics.writes`, read as the step tree the server would store, exit 1 on a field no entry covers, and declaring none only warns; a description carrying `<placeholder>` syntax exits 1, since the catalogue escapes angle brackets — state the format as an example; so does one naming a desk `query_apps` does not list. |
|
|
72
72
|
| `lotics app check --screens [--screen <label>] [--width <n>] [--shots <dir>] [--changed]` | **`--screens` adds the rendered surface**: the app is served the way `app dev` serves it (its real data, this key), rendered headless in Chrome (`CHROME_PATH`/`LOTICS_CHROME`, then Playwright's, then system) at 1280 and 375. **The screens are its navigation's destinations** — a `nav` landmark's `a[href]` or `role="link"` (an app's route lives in its router, so the kit's shell renders each screen as a button carrying the link role and no `href`), else the first tab strip, else the root — in that order, because a screen's own lifecycle desk draws a tablist too, and reaching for one first walks a screen's STAGES as if they were the app's. **Each screen is then WALKED THROUGH ITS OWN DOORS**, nothing configured per app: every door is named by something the document states. A record: a row stamped `data-opens="page"`, a real `a[href]`, or an EMPTY DOOR — a named control with no text and no child element, the only legal whole-row press target, which reaches a drawer register, a Schedule row and a hand-written row alike. On a record: the acts menu (`aria-haspopup`), the first child row. On any surface: every dialog a visible primary or secondary act raises — nothing announces one, so a press is kept only where an overlay appeared. **THE RUN IS A READ, AND THE NETWORK IS WHERE THAT IS ENFORCED — never a rule about what the page may draw.** The app frame holds no credential and Chrome runs on a throwaway profile, so every call the app makes reaches the workspace through this CLI and nowhere else, and this CLI serves an ALLOWLIST of reads. Everything outside it is refused before the call leaves the machine — a workflow run, a record write, an upload, an agent run, a comment, and any op this CLI does not know, which is refused because it is not on the list rather than because anyone listed it. A refused call HEADS the report, naming the surface, the control the app had focused and the RPC by its alias (never a payload value), and fails the run on its own: a walk that provoked a write left the app in a state no reader could have put it in, so nothing measured under it means anything. What the walk does is bounded on the page as well: nothing inside an open overlay, nothing typed, no submit and nothing in a form, no act the kit marks costly (`data-tone` danger/warning) and none whose own name is the write, in either language — and nothing is FOCUSED, because focus cannot be taken from one field without leaving another, and a field that saves itself when the reader leaves it saves on exactly that. Where a reading needs the focused state, as the focus-ring rule does, Chrome is asked to PAINT `:focus-visible` and release it again: the cascade answers, focus never moves and no event is dispatched. Each overlay closes with Escape, confirmed closed; a record is descended at most twice; the walk stops at twelve surfaces per screen and NAMES each door it left. Each surface is measured once no request is in flight, and the measurable probes of `@lotics/ui` docs/reviewing.md run over the DOM, each finding printing the rule it IS — its law, its section and the one edit that answers it — so the numbers need no key. What they exempt is what the screen itself declares: a register's ordinal gutter (a column counting to the row count is the shape's numbering, which no app can treat), a strip whose list carries `data-order="sequence"` (a lifecycle rail, which composition.md permits under a screen's tabs), a hairline or `clip-path`-clipped leaf (the visually-hidden node a control plants for a screen reader), and a leaf whose own computed line clamp states a count over a sentence. **A meter counts as an encoding only where it draws a POSITION** — `aria-valuenow` inside a range with room left. A bar pinned at its own maximum — what a meter alarmed AT its maximum draws on every alarmed row — reads the same as every value above it, and one with no maximum states none; both are counted in the census's `devices` and out of its `encoded`, so "nothing drawn" and "drawn and saying nothing" never read alike. The bare values that remain are grouped into columns, each named by the heading over it, so a finding says WHICH slot draws its figures as words. **Two finding classes read what geometry cannot.** `clutter` (docs/hierarchy.md): a second primary act, a value in two places on a record, a box reserving more lines than it holds, markers on over half a form's fields, a second accent. `right_form` (docs/screen.md's device index): a boolean as a two-option select, a day run as a repeated date column where the kit ships `Schedule`. Each prints a line per rule fired, with three offenders. **Four read room and counts** (reviewing.md §8l–§8o): `reserved_blank`, a register column 40px or wider that is blank (no text, no control) on more than half the rows in view, or a row-act gutter leaving 40px beside the acts on them — a row a complete register draws for nothing stored (`data-ghost`, a day nobody filed) is no row of the set; `shed_with_room`, a column the register's width gave up (the kit states them as `data-shed`) that, with the gap between two columns, fits in what its slots hold beyond what each must seat — its heading and widest ink, a fixed column's whole width, the acts most rows have; `action_off_heading`, a section's create (a control stating `data-create`) drawn in its body rather than its heading row; and `partial_count`, a count or `n of N` equal to the rows in hand of a read the server cut on the screen being walked, where the server's own count of the same alias, params and filter — asked by this CLI, a read — says otherwise. **Three read a record's anatomy** (docs/hierarchy.md), over each record on the surface with the title heading it: `record_primary`, a primary act in a block's heading row — a block's add is secondary beside the record's own acts (two under one heading are `clutter`'s); `fact_repeats`, a field whose value reads the same as the header's own words, whatever its case; and `empty_block`, a block that draws nothing under its heading, not even the line saying it is empty. A census line per screen (text runs, money strings, bare values against the devices reading, tab strips) prints first, so a clean verdict over a screen that rendered nothing cannot pass; a screen that renders no text is itself a finding, and one still changing after fifteen seconds is measured as it is. **A cold dependency optimisation is waited out, not measured**: the first paint has its own bound, far longer than settle's, since an app's modules load after its document completes and Vite holds them; only a MOUNTED, idle, textless frame is blank at once, and the finding names the wait and its blocker. It also RELOADS the page under the probe, so a width is measured again once; a second reload is a page that keeps moving and fails. **`--screen <label>` and `--width <n>` narrow a run** (repeatable, comma-separated; the label matches case-insensitively as a substring), for the author iterating on one screen who would otherwise pay a typecheck, a Vite boot and every screen at both widths on every edit; the clean verdict then names only the widths covered, and a `--screen` matching nothing is refused. **`--shots <dir>` writes what the run measured** — a `<surface>@<width>.png` and a `<surface>@<width>.json` per surface, off the SAME settled frame the probes read, so a shot and a finding can never describe different pixels. The PNG is the WHOLE surface: an app scrolls inside a box of its own, so the window is grown to the height the probe measured and put back, and an overlay a resize dismissed is shot as the viewport, the sidecar saying so (`app dev`'s header band is in it — the band the app was laid out under). The JSON is the half a picture cannot carry: the nav's first item's left edge, the title and first section heading, the primary acts by name, label/value pairs against what the folds state, values drawn twice, money that wraps, text the layout cut, and the console errors and uncaught exceptions the frame raised. Named `<nn>-<slug>` plus one `__<step>` per door taken (`__record`, `__menu`, `__child`, `__fold`, `__dialog-<n>`); `<nn>` is the walk's index, which lists the directory in reading order and keeps two labels that fold to one ASCII slug apart. The row a record surface opened from is the sidecar's `opened_from` and that screen's census line, never a file name — it is a person's data. The directory is created if missing, and refused before the dev server boots when it cannot be; `--shots` without `--screens` is refused. Findings exit 1 like the rest. **Where it renders**: the app's files are copied into the render project of its DEPENDENCY SET — `~/.lotics/render/<key>/`, keyed by the manifest's `dependencies` and `devDependencies` as written, a `file:` tarball by its bytes — the one `app preview` renders in, so the install and Vite's dependency optimisation are paid once per set rather than per app; one render holds a project at a time (`<key>.lock` — a second run waits, naming the app and pid, and takes over a dead hold). Where that install resolved another runtime or kit than the app's own, the run says which, since a deploy builds the app's own. The run ends with what each phase cost: `preflight · install|reuse · walk`. **`--changed`** walks only when something the screens READ has moved since this checkout's last walk — each part of `app.json` (every record apart), each declared query, each bundled source file, the field map, the ranges, the kit the render resolved and the CLI version, whose probes measure them — read against `.lotics/screens_check.json`, which every walk writes; with nothing moved, that walk's report is printed again under its timestamp and still fails the run. An app's screens all read its one spec, so a move walks the app whole. It walks, saying why, with no earlier walk, a different `--screen`/`--width`, or `LOTICS_UI_SRC` set (a linked working copy has no fingerprint); the workspace's rows are not an input. `--changed` without `--screens`, or beside `--shots`, is refused. |
|
|
73
73
|
| `lotics app preview <model.json>#<app> [--shots <dir>] [--width <n>] [--screen <label>] [--kit <path>]` | **The app a model states, RENDERED — before a table exists, and with no credential in the process.** The model is checked offline, the named app is compiled against the workspace the model WOULD become (synthetic `tbl_`/`fld_`/`opt_`/`grp_` ids, minted positionally off the file), and every read the app makes is answered from the model's own `rows` — projected under the columns the query names, narrowed by the params it declares and sorted the way it states, so a child block under a record holds that record's rows and not every parent's. An entity the app reads that states no `rows` gets three synthesized, so a register never measures clean over nothing. Then the SAME headless walk `app check --screens` takes: the register, the record its first row opens in its door, and the add dialog, at 1280 and 375, measured by the same probes. `--shots` writes a PNG and a sidecar per surface. **Exits 1 on any finding**, exactly as the check does, and prints what each phase cost — bind, install-or-reuse, walk. **Nothing is created and nothing is reached** — no app row, no table, no workspace; the only network it needs is the npm registry, and only when the kit has moved. It renders in the cached render project of its dependency set (`~/.lotics/render/<key>/`, shared with `app check --screens` and with every model whose app lists the same set, and held by one render at a time — a second run waits, naming the app and pid holding it, and takes over a hold whose process is gone): the runtime and its kit are PUBLISHED packages, so a project is what a preview needs to install them into — the CLI has no renderer of its own. **It installs the runtime this CLI was built for**, and the kit through it, never `latest`: the spec this binary's generator writes is the one that runtime reads, and a version that published mid-session is a runtime nobody checked the model against. A version the registry does not serve yet is refused before npm runs, naming `--kit`. **`--kit <checkout>`** (repeatable) — a checkout's ROOT, which names the app-runtime and the ui it holds, or one of those two packages — renders against that checkout instead — built, packed and proven the way `lotics app kit` installs one into an app — and the run prints that it rendered against a LOCAL CHECKOUT, first and last, so the render is never read as the published one. The project is a CACHE and never a source: `npm install` runs on the first render of a set and again only when a checkout's tarball did, and every file in it is rewritten from the model on each run. **A document a row names by path is served** from the project's own static root, as the named file a workspace would hold, so a files block and a record's picture read what the model states; a `fil_` id is carried by name. **`--record <ref>`** opens that row's record by its own address — a row of the app's entity, by the ref the model gives it, open or closed — where the walk otherwise opens the first row the register lists; a ref naming no such row is refused with the refs there are. **Every read is answered at the BRIDGE**, not inside the page. The app SDK's design-time fixture (`registerMockFixture` + `?__mock=1`) is the wrong half of this: the flag lives in the app's own url, and the first record page is a navigation the app's router performs — so from that surface onwards the flag is gone and every read falls through anyway. The bridge is the one place every call arrives whatever the url says, so `query`, `field_options`, `members` and `context` are answered there from one reading of the rows, and the generated entry ships EXACTLY as `app create --from` writes it. **A preview writes nothing**: a workflow, an upload or an agent run meets the same read gate `app check --screens` uses, so the app draws its own refusal path rather than reporting a save nothing moved for, and the call is reported above the census the way the check reports one. **What came out empty, it names**: a `formula`, `rollup`, `lookup` or `autonumber` is computed here rather than stated in the model, and the census lists each computed column that stayed empty on EVERY row of a table that has rows — named by outcome, since a total drawn blank is either the app's own answer or a hole and only the run can say which. The census reads the CELLS and not the field types, so nothing is exempt by kind. **A computed column that came out `#ERROR:` is named too, and the run refuses it** before anything is installed: a wall of red measures clean, and a run that drew it and exited 0 would tell its author the app is fine. **It computes in UTC**, because a model states no timezone — a row's `@today`, an autonumber's `{YEAR}` and a record's own clock all land on the run's own date at UTC midnight, so two runs of one model draw the same register wherever they are made. |
|
|
74
74
|
| `lotics app workflow set <alias>` | Push the edited `src/workflows/<alias>.ts` body through `set_app_workflow` (the single author of `apps.workflows`). Reads the body from disk (header + `/// <reference>` + `export {};` marker + the `__workflow` wrapper all stripped) + the typed `inputs`/`outputs` **and the `description`** from `package.json#lotics.workflows.<alias>`; the **server** re-verifies the body and echoes the bound `outputs` (declared, else DERIVED from `return({ data })`). The `description` is the one line an agent reads when choosing between the app's aliases (the workflow counterpart to a query's) — authored in the manifest so it lives beside the body in version control and rides every push; omit it and the workflow keeps whatever description it already has, so a push can never blank one set elsewhere. When the manifest declared NO `outputs`, the DERIVED echo is written back into `package.json#lotics.workflows.<alias>.outputs` (a SURGICAL write — preserves `knowledge`/`config` and every other manifest field) and that alias's types are refreshed in place, so `useWorkflow("<alias>")`'s `result.data` is typed immediately with no hand-copy and no second `lotics app codegen`; an explicitly-declared `outputs` is authoritative and never overwritten. A deploy runs this same verb for every alias whose declaration or body is ahead of the app, so this command is the one-alias spelling of what a release does, not a step a release leaves to a person. Clear error + non-zero exit on a missing file, an alias absent from the manifest, or a verify failure. A push also prints any non-blocking verify warnings, including an input the alias declares that the body never reads. A first bind MINTS the workflow row, and the id it echoes is written back into `package.json#lotics.workflows.<alias>.workflow_id` — the same surgical write the derived `outputs` gets. Without it a hand-declared alias ended up shaped unlike its siblings, so anything reading the manifest (an audit, a port to another workspace, a person comparing two blocks) had to treat a missing id as normal, which is exactly how a genuinely missing one stops being visible. **`--acknowledge-breaking-api`** carries this write out even though it breaks what the app's published API promises, snapshotting the broken contract as a new version; without it such a write is refused and every breaking change is named (see `app api`). |
|