@lotics/cli 0.76.0 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -197,7 +197,7 @@ lotics ui link card --remove # finalize: PR + publish, then drop t
197
197
 
198
198
  ## App packages
199
199
 
200
- A maintained, versioned app library: author once, install into many workspaces, upgrade per-workspace. Any org authors its own packages (publishing is owner-org-only); Lotics-backed packages carry the `official` badge. See `docs/app_packages.md` for the model.
200
+ A maintained, versioned app library: author once, install into many workspaces, upgrade per-workspace. Any org authors its own packages (publishing is owner-org-only); Lotics-backed packages carry the `official` badge. See `docs/packages.md` for the model.
201
201
 
202
202
  ```bash
203
203
  # Author (any org admin; the package is owned by your org)
@@ -222,6 +222,7 @@ lotics package upgrade app_... # preview, then apply (additive; over
222
222
  lotics package fleet-upgrade apg_... # upgrade EVERY org installation (clean ones apply; findings skip, exit 1)
223
223
  lotics package upgrade app_... --resolve fields.deal.stage=recreate # resolve reported drift
224
224
  lotics package upgrade app_... --resolve queries.tasks=keep # consent for a local edit (or =revert)
225
+ lotics package upgrade app_... --resolve template.quote=revert # a locally-edited template (clean ones auto-update; or =keep)
225
226
  lotics package eject app_... # one-way: sever the package link
226
227
  lotics workspace doctor # dangling schema references across the workspace (exit 1 on findings)
227
228
 
@@ -238,6 +239,35 @@ lotics package adopt app_... # bind the package onto the origin ap
238
239
 
239
240
  Extract writes `.lotics/adopt_binding.json` (the origin pin, excluded from published bundles); `adopt` reads it back and refuses a pin recorded for a different app. After promotion the package project is the master — iterate contract-first (`package dev`/`sync` → `publish`), never extract again.
240
241
 
242
+ ### Content packages
243
+
244
+ A **content** package ships **knowledge docs and/or document templates** — no app, just the artifacts. Knowledge is the reference corpus an agent looks up by name; templates are standalone document templates. Content comes two ways: bundled *with an app* (installing the app delivers its agents' docs) or as a standalone content package (a versioned corpus). Install delivers, upgrade refreshes — preserving stable `kdc_`/`tmpl_` ids + a version snapshot per change. See `docs/packages.md` § Content.
245
+
246
+ ```bash
247
+ # Author a content package (scaffolds a knowledge/ dir + manifest; add templates/ + a
248
+ # lotics.package.templates entry per template — inline html/email or file-backed excel/word/pdf-form)
249
+ lotics package new my-sops --kind content
250
+ lotics package publish -m "v1: SOP corpus + templates"
251
+
252
+ # Install into a workspace (a same-named local DOC collides — consent with --bind-to; templates never collide)
253
+ lotics package install apg_... # app OR content, kind-branched
254
+ lotics package install apg_... --bind-to policy=kdc_... # adopt an existing doc as package-managed
255
+
256
+ # Discover installed content (the source for a pci_ id — install prints it once)
257
+ lotics package list-content # id · package · version · standalone vs app-bundled
258
+
259
+ # Refresh a standalone content install (pci_ id from install / list-content) — one gate over docs + templates
260
+ lotics package upgrade pci_... # preview, then apply
261
+ lotics package upgrade pci_... --resolve policy=apply # a doc: apply|keep|archive|recreate|unbind
262
+ lotics package upgrade pci_... --resolve quote=revert # a locally-edited template: revert|keep (clean ones auto-update)
263
+ lotics package upgrade pci_... --apply-all # accept upstream for every doc + template (OVERWRITES local edits)
264
+ lotics package uninstall pci_... --keep-content # remove the pin; keep docs + templates (default archives them)
265
+ ```
266
+
267
+ A package's knowledge can also arrive **bundled with an app**. Upgrading such an app (`lotics package upgrade <app_id>`) previews its bundled-knowledge changes alongside the plan and resolves them with the SAME flags: a `--resolve <alias>=apply|keep|archive|recreate|unbind` naming a bundled doc routes to the doc (anything else stays a core-artifact resolution; a name that is both errors), `--bind-to` consents an added-doc collision, `--apply-all` takes the package's version for every consent-requiring doc.
268
+
269
+ To package the knowledge an existing app's agents route to, declare it in the app project's `package.json#lotics.knowledge` (`[{ alias, doc_id }]`, + `lotics.knowledge_expects` for docs the agents assume but the package doesn't own), then `lotics package extract` / `adopt` as usual.
270
+
241
271
  ## SDK
242
272
 
243
273
  ```typescript
package/dist/args.d.ts CHANGED
@@ -50,14 +50,27 @@ export declare function parseArgs(argv: string[]): {
50
50
  * `--resolve <key>=recreate|revert|keep|<id>` (repeatable): upgrade
51
51
  * resolutions — drift entries (`<namespace.alias>`) take `recreate` or an
52
52
  * existing id; modified-core entries (`<kind>.<alias>`) take `revert` or
53
- * `keep`.
53
+ * `keep`. For a standalone KNOWLEDGE upgrade, `<alias>=apply|keep|archive|
54
+ * recreate|unbind`.
54
55
  */
55
56
  resolve: string[];
57
+ /**
58
+ * `--bind-to <alias>=<kdc_id>` (repeatable): consent to adopt an existing
59
+ * same-named doc as package-managed — resolves a knowledge name collision at
60
+ * install / a created-doc collision at upgrade.
61
+ */
62
+ bindTo: string[];
63
+ /** `--keep-content` (`package uninstall` of a content install): retain the package-bound docs instead of archiving them. */
64
+ keepContent: boolean;
65
+ /** `--apply-all` (knowledge `package upgrade`): accept the package's version for every consent entry. */
66
+ applyAll: boolean;
67
+ /** `--kind <app|content>` (`package new`): the package project kind to scaffold (default app). */
68
+ kind?: string;
56
69
  /** `--config key=value` (repeatable): per-knob config overrides at `package install`. */
57
70
  config: string[];
58
71
  /** `--set key=value` (repeatable): per-knob config edits at `package config`. */
59
72
  set: string[];
60
- /** `--archive-tables`: also archive the scaffolded tables at `package uninstall`. */
73
+ /** `--archive-tables` (`package uninstall` of an app install): also archive the scaffolded tables. */
61
74
  archiveTables: boolean;
62
75
  /** `--undo`: reverse a `package retire` / `package yank`. */
63
76
  undo: boolean;
package/dist/args.js CHANGED
@@ -31,6 +31,10 @@ export function parseArgs(argv) {
31
31
  cleanup: false,
32
32
  packageVersion: undefined,
33
33
  resolve: [],
34
+ bindTo: [],
35
+ keepContent: false,
36
+ applyAll: false,
37
+ kind: undefined,
34
38
  config: [],
35
39
  set: [],
36
40
  archiveTables: false,
@@ -110,6 +114,23 @@ export function parseArgs(argv) {
110
114
  flags.resolve.push(value);
111
115
  break;
112
116
  }
117
+ case "--bind-to": {
118
+ const value = argv[++i];
119
+ if (value === undefined || value.startsWith("-")) {
120
+ throw new Error("--bind-to requires a value: <alias>=<kdc_id>.");
121
+ }
122
+ flags.bindTo.push(value);
123
+ break;
124
+ }
125
+ case "--keep-content":
126
+ flags.keepContent = true;
127
+ break;
128
+ case "--apply-all":
129
+ flags.applyAll = true;
130
+ break;
131
+ case "--kind":
132
+ flags.kind = argv[++i];
133
+ break;
113
134
  case "--config": {
114
135
  const value = argv[++i];
115
136
  if (value === undefined || value.startsWith("-")) {
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import { LoticsClient, API_BASE_URL } from "./client.js";
14
14
  import { resolveContext, deleteConfig, getConfigPath, loadGlobalConfig, saveGlobalConfig, loadLocalConfig, upsertProfile, removeProfile, setActiveOrg, setSelectedWorkspace, resolveProfileByNameOrId, checkForUpdate, } from "./config.js";
15
15
  import { VERSION } from "./version.js";
16
16
  import { appCreate, appPull, appDeploy, appDev, appSetSubdomain, appRename, appVersions, appCodegen, appExecuteWorkflow, appWorkflowSet, appWorkflowPull, appWorkflowCheck, appQuerySet, appUiLink, } from "./app_commands.js";
17
- import { packageInstall, packageUninstall, packageConfig, packageRetire, packageShow, parseInstallConfigFlags, packageEject, packageDoctor, packageUpgrade, parseResolveFlags, packageNew, packageBuild, packagePublish, packageDev, packageSync, packageReset, packageExtract, packageAdopt, packageFleetUpgrade, packageYank, } from "./package_commands.js";
17
+ import { packageInstall, packageUninstall, packageListContent, packageConfig, packageRetire, packageShow, parseInstallConfigFlags, packageEject, packageDoctor, packageUpgrade, packageUpgradeKnowledge, parseBindToFlags, packageNew, packageBuild, packagePublish, packageDev, packageSync, packageReset, packageExtract, packageAdopt, packageFleetUpgrade, packageYank, } from "./package_commands.js";
18
18
  import { parseArgs } from "./args.js";
19
19
  import { ingestJsonArgs } from "./inputs.js";
20
20
  import { runXlsxCommand } from "./xlsx.js";
@@ -96,31 +96,41 @@ COMMANDS
96
96
  lotics app subdomain <new-subdomain> Rename the app's public <slug>.lotics.app address
97
97
  lotics app rename "<new name>" Rename the app's display name (launcher title)
98
98
  lotics app dev [path] Run the app locally with HMR (RPC forwarded to prod)
99
- lotics package new <name> [path] Scaffold a package project (contract + app source)
99
+ lotics package new <name> [path] [--kind app|content]
100
+ Scaffold a package project — an app (contract + source)
101
+ or a content corpus (docs-only, no app source)
100
102
  lotics package build [path] Build the publishable bundle (source + dist)
101
103
  lotics package publish [path] Publish a new immutable package version
102
104
  lotics package dev [path] Sync the package into a dev workspace + run the app
103
105
  dev server (--workspace <dev_ws> selects it)
104
106
  lotics package sync [path] Re-sync (additive migrate + materialize) into a dev ws
105
107
  lotics package reset [path] DEV-ONLY: drop scaffolded tables + re-scaffold clean
106
- lotics package install <package> [--version N] [--config key=value ...]
107
- Install an app package into this workspace
108
- (scaffolds the data model + deploys + materializes)
109
- lotics package uninstall <app_id> [--archive-tables]
110
- Remove an installation (archives artifacts; with the
111
- flag also archives the scaffolded tables it created)
108
+ lotics package install <package> [--version N] [--bind-to <alias>=<kdc_id> ...] [--config key=value ...]
109
+ Install a package (app: scaffolds/deploys/materializes,
110
+ --config sets its knobs; content: installs the doc corpus,
111
+ --bind-to consents to adopt a same-named doc on a collision)
112
+ lotics package uninstall <app_id|pci_id> [--archive-tables] [--keep-content]
113
+ Uninstall dispatched by id. App (app_id): archives
114
+ artifacts (+ --archive-tables also archives scaffolded
115
+ tables). Content (pci_): archives its package-bound docs
116
+ unless --keep-content
112
117
  lotics package config <app_id> [--set key=value ...]
113
118
  Show or edit an installation's config knobs
114
119
  lotics package show <package_id> Registry metadata + version history
115
120
  lotics package retire <package_id> [--undo]
116
121
  Retire a package (refuse new installs, hide from other
117
122
  orgs); existing installations keep working + upgrade
118
- lotics package upgrade <app_id> [--version N] [--resolve <key>=recreate|revert|keep|<id> ...]
119
- Preview-then-apply a package upgrade; refuses while
120
- any drift/modified finding lacks a --resolve, and
121
- hard-stops on breaking contract changes
123
+ lotics package list-content List the workspace's content installations
124
+ (standalone pci_ + app-bundled) source for a pci_ id
125
+ lotics package upgrade <app_id|pci_id> [--version N] [--resolve <key>=... ] [--bind-to ...] [--apply-all]
126
+ Preview-then-apply an upgrade. App: refuses while any
127
+ drift/modified/bundled-knowledge finding lacks a --resolve
128
+ (a knowledge-alias --resolve routes to the doc). Content
129
+ (pci_): --resolve <alias>=apply|keep|archive|recreate|unbind;
130
+ --apply-all accepts the package's version for every doc
122
131
  lotics package doctor [app_id] Installation health: version pin vs latest, binding
123
- drift, locally modified core (exit 1 on findings)
132
+ drift, locally modified core, knowledge drift/edits
133
+ (exit 1 on findings)
124
134
  lotics package rebind-role <app_id> <alias> <grp_id>
125
135
  Re-point a package role at a different group
126
136
  (re-materializes at the pinned version)
@@ -167,6 +177,12 @@ FLAGS
167
177
  --local Pin the current directory (lotics org use / auth api-key)
168
178
  --dev (lotics workspace create) Mark a throwaway app-package dev
169
179
  workspace — required for "lotics package reset"
180
+ --kind <k> (lotics package new) Package kind: app (default) or content
181
+ --bind-to <a>=<id> (lotics package install/upgrade, repeatable) Adopt an existing
182
+ same-named doc as package-managed (resolves a knowledge collision)
183
+ --keep-content (lotics package uninstall) Keep the docs instead of archiving them
184
+ --apply-all (lotics package upgrade, knowledge) Accept the package's version
185
+ for every doc (overwrites local edits)
170
186
  --all (lotics auth logout) Remove every saved credential
171
187
  --version Show version
172
188
 
@@ -585,10 +601,18 @@ async function main() {
585
601
  if (command === "package" && subcommand === "new") {
586
602
  const name = toolArgs;
587
603
  if (!name) {
588
- console.error("Usage: lotics package new <name> [path]");
604
+ console.error("Usage: lotics package new <name> [path] [--kind app|content]");
589
605
  process.exit(1);
590
606
  }
591
- await packageNew({ name, targetPath: restArgs[0] });
607
+ if (flags.kind !== undefined && flags.kind !== "app" && flags.kind !== "content") {
608
+ console.error(`Invalid --kind "${flags.kind}" — expected "app" or "content".`);
609
+ process.exit(1);
610
+ }
611
+ await packageNew({
612
+ name,
613
+ targetPath: restArgs[0],
614
+ kind: flags.kind === "content" ? "content" : "app",
615
+ });
592
616
  return;
593
617
  }
594
618
  if (command === "package" && subcommand === "build") {
@@ -703,19 +727,20 @@ async function main() {
703
727
  }
704
728
  if (command === "package" && !subcommand) {
705
729
  console.error("Usage:");
706
- console.error(" lotics package new <name> [path] Scaffold a package project (contract + app source)");
730
+ console.error(" lotics package new <name> [path] [--kind app|content] Scaffold a package project (app source, or docs-only)");
707
731
  console.error(" lotics package build [path] Build the publishable bundle (source + dist)");
708
732
  console.error(" lotics package publish [path] [-m <changelog>] Publish a new immutable package version");
709
733
  console.error(" lotics package dev [path] [--workspace <ws>] Sync into a dev workspace + run the app dev server");
710
734
  console.error(" lotics package sync [path] [--workspace <ws>] Re-sync (additive migrate + materialize) into a dev workspace");
711
735
  console.error(" lotics package reset [path] [--workspace <ws>] DEV-ONLY: drop scaffolded tables + re-scaffold clean");
712
- console.error(" lotics package install <package> [--version N] [--config key=value ...] Install a package into this workspace");
713
- console.error(" lotics package uninstall <app_id> [--archive-tables] Remove an installation (opt-in table archival)");
736
+ console.error(" lotics package install <package> [--version N] [--bind-to <alias>=<kdc_id>] [--config key=value ...] Install a package (app or content)");
737
+ console.error(" lotics package uninstall <app_id|pci_id> [--archive-tables] [--keep-content] Uninstall dispatched by id (app vs content)");
714
738
  console.error(" lotics package config <app_id> [--set key=value ...] Show or edit an installation's config knobs");
715
739
  console.error(" lotics package show <package_id> Registry metadata + version history (channel, yank, changelog)");
716
740
  console.error(" lotics package retire <package_id> [--undo] Retire a package (refuse new installs; installs keep working)");
717
- console.error(" lotics package upgrade <app_id> [--version N] [--resolve ns.alias=recreate|<id>] Preview + apply an upgrade");
718
- console.error(" lotics package doctor [app_id] Health: version pin vs latest + binding drift");
741
+ console.error(" lotics package list-content List the workspace's content installations (standalone + app-bundled)");
742
+ console.error(" lotics package upgrade <app_id|pci_id> [--version N] [--resolve <key>=... ] [--bind-to ...] [--apply-all] Preview + apply an upgrade");
743
+ console.error(" lotics package doctor [app_id] Health: version pin vs latest + binding/knowledge drift");
719
744
  console.error(" lotics package rebind-role <app_id> <alias> <grp_id> Re-point a package role at another group");
720
745
  console.error(" lotics package eject <app_id> Sever an installation's package link");
721
746
  console.error(" lotics package extract <app_id> [path] Promote a bespoke app to a draft package project");
@@ -873,7 +898,7 @@ async function main() {
873
898
  if (subcommand === "install") {
874
899
  const packageId = toolArgs;
875
900
  if (!packageId) {
876
- console.error("Usage: lotics package install <package> [--version N]");
901
+ console.error("Usage: lotics package install <package> [--version N] [--bind-to <alias>=<kdc_id> ...]");
877
902
  process.exit(1);
878
903
  }
879
904
  let version;
@@ -888,17 +913,29 @@ async function main() {
888
913
  await packageInstall(client, {
889
914
  package_id: packageId,
890
915
  version,
916
+ bind_to: parseBindToFlags(flags.bindTo),
891
917
  ...(config !== undefined ? { config } : {}),
892
918
  });
893
919
  return;
894
920
  }
895
921
  if (subcommand === "uninstall") {
896
- const appId = toolArgs;
897
- if (!appId) {
898
- console.error("Usage: lotics package uninstall <app_id> [--archive-tables]");
922
+ const id = toolArgs;
923
+ if (!id) {
924
+ console.error("Usage: lotics package uninstall <app_id|pci_id> [--archive-tables] [--keep-content]");
925
+ console.error("Dispatched by id: an app installation (app_id; --archive-tables to also archive its " +
926
+ "scaffolded tables) or a standalone content installation (pci_ id from install / " +
927
+ "lotics package list-content; --keep-content to retain its docs).");
899
928
  process.exit(1);
900
929
  }
901
- await packageUninstall(client, { app_id: appId, archive_tables: flags.archiveTables });
930
+ await packageUninstall(client, {
931
+ id,
932
+ keep_content: flags.keepContent,
933
+ archive_tables: flags.archiveTables,
934
+ });
935
+ return;
936
+ }
937
+ if (subcommand === "list-content") {
938
+ await packageListContent(client);
902
939
  return;
903
940
  }
904
941
  if (subcommand === "config") {
@@ -1003,7 +1040,7 @@ async function main() {
1003
1040
  console.error("Usage: lotics package rebind-role <app_id> <role_alias> <grp_id>");
1004
1041
  process.exit(1);
1005
1042
  }
1006
- const result = await client.rebindAppPackageRole(appId, {
1043
+ const result = await client.rebindPackageRole(appId, {
1007
1044
  role_alias: roleAlias,
1008
1045
  group_id: groupId,
1009
1046
  });
@@ -1013,9 +1050,9 @@ async function main() {
1013
1050
  return;
1014
1051
  }
1015
1052
  if (subcommand === "upgrade") {
1016
- const appId = toolArgs;
1017
- if (!appId) {
1018
- console.error("Usage: lotics package upgrade <app_id> [--version N] [--resolve <namespace.alias>=recreate|<id> ...]");
1053
+ const target = toolArgs;
1054
+ if (!target) {
1055
+ console.error("Usage: lotics package upgrade <app_id | pci_installation_id> [--version N] [--resolve <key>=... ...]");
1019
1056
  process.exit(1);
1020
1057
  }
1021
1058
  let version;
@@ -1026,10 +1063,24 @@ async function main() {
1026
1063
  process.exit(1);
1027
1064
  }
1028
1065
  }
1066
+ // A `pci_` id is a standalone content installation (its own upgrade
1067
+ // pipeline); everything else is an app installation.
1068
+ if (target.startsWith("pci_")) {
1069
+ await packageUpgradeKnowledge(client, {
1070
+ installation_id: target,
1071
+ version,
1072
+ resolve: flags.resolve,
1073
+ bind_to: parseBindToFlags(flags.bindTo),
1074
+ applyAll: flags.applyAll,
1075
+ });
1076
+ return;
1077
+ }
1029
1078
  await packageUpgrade(client, {
1030
- app_id: appId,
1079
+ app_id: target,
1031
1080
  version,
1032
- resolutions: parseResolveFlags(flags.resolve),
1081
+ resolve: flags.resolve,
1082
+ bindTo: flags.bindTo,
1083
+ applyAll: flags.applyAll,
1033
1084
  });
1034
1085
  return;
1035
1086
  }