@trillioncore/cli 1.0.0-next.1 → 1.0.0-next.3

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.
Files changed (3) hide show
  1. package/README.md +20 -0
  2. package/dist/index.js +25 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -37,6 +37,26 @@ CLI and MCP share four data-tool names: `index`, `search`, `get`, and `sql`. CLI
37
37
 
38
38
  Use `tc <command> --help` for supported flags. PostgreSQL SQL is a focused v1 command, not general v0 compatibility. There is no v0 `agent start`, chat, or write-command compatibility layer. CLI credentials cannot be used as MCP credentials or browser administration sessions. Authorize Codex or Claude Code separately through hosted MCP.
39
39
 
40
+ ## Resource discovery
41
+
42
+ Run `tc index` to obtain an authorized account path, then:
43
+
44
+ ```sh
45
+ tc index 'org/<organization-id>/account/<account-id>' --resources --json
46
+ ```
47
+
48
+ For interactive inspection, omit `--json` to print schema columns, operation availability, warnings and the next-page cursor as text. Use `tc index --help` to discover resource and pagination options.
49
+
50
+ MCP uses the same `index` tool with that `path` and `resources: true`. Resource mode returns an additive `catalog`, empty `entries`, and the normal `nextCursor` pagination field. Repeat the same resource request with `--cursor` while a cursor is returned. Changed catalog metadata invalidates old resource cursors; restart discovery. Normal index responses and record refs are unchanged. Resource mode avoids enumerating every stored record.
51
+
52
+ The catalog describes stored content kinds or approved **active synchronized** PostgreSQL relations, supported operations, schema metadata and known sync timestamps. Resource keys identify catalog entries; they are **not** refs accepted by `get`. Obtain a record ref through normal index/search before reading. Search is lexical across authorized connections, not scoped to the resource just inspected; optional source-type filters do not identify a unique connection.
53
+
54
+ For native content, `recordSchemas` describes the allowed scalar fields in `get`'s `attributes`, grouped by recognized observed record kind. These field names/types come from the same definitions used to validate stored records. Fields may be absent on individual records; a schema does not prove populated values, complete history, relationship IDs, or SQL support. Empty connections return no observed schemas; unknown kinds remain listed without invented definitions. Table resources retain their separate `relation.columns` metadata.
55
+
56
+ Respect `operations[].available` and `warnings`. Production synced SQL is currently not wired, so its schemas can be discovered but SQL is explicitly unavailable with `synced_sql_not_configured`. Live PostgreSQL resources are outside this catalog's coverage. No semantic search or actions are advertised. Native connectors retain search/get capabilities when empty; `recordKinds` lists only observed kinds (capped at 100 with an explicit warning). Synced manifests use existing limits of 25 tables/1,000 columns. A successful sync timestamp does not establish complete history or current provider state. Business definitions, currency and attribution are not inferred.
57
+
58
+ All discovery uses the same organization, live token scope, connection permission and enabled-state checks as existing agent reads. Multiple internal adapters may eventually fulfill a connection's capabilities; this catalog does not introduce a separate user-visible integration for each adapter.
59
+
40
60
  ## Sessions and troubleshooting
41
61
 
42
62
  Sessions refresh automatically. File-based credentials live in `~/.trillioncore/cli-v1/session.json`, with private directory/file permissions (0700/0600 on POSIX), atomic replacement and cross-process refresh locking. Never share or print this file. Keep the OS account and its private home directory secure; Windows ACL behavior has not yet been independently validated.
package/dist/index.js CHANGED
@@ -3757,6 +3757,7 @@ async function index(input) {
3757
3757
  const limit = parsedPositiveInteger(input.limit, "--limit", 200);
3758
3758
  const parameters = new URLSearchParams();
3759
3759
  if (input.path) parameters.set("path", input.path);
3760
+ if (input.resources) parameters.set("resources", "true");
3760
3761
  if (depth) parameters.set("depth", String(depth));
3761
3762
  if (limit) parameters.set("limit", String(limit));
3762
3763
  if (input.cursor) parameters.set("cursor", input.cursor);
@@ -3847,6 +3848,29 @@ function isAgentError(value) {
3847
3848
  return "error" in value;
3848
3849
  }
3849
3850
  function renderIndex(result) {
3851
+ if (result.catalog) {
3852
+ const catalog = result.catalog;
3853
+ return [
3854
+ `Resources: ${catalog.connectionRef}`,
3855
+ `Last successful sync: ${catalog.freshness.lastSuccessfulSyncAt ?? "unknown"}; source completeness: ${catalog.freshness.sourceCompleteness}`,
3856
+ ...catalog.resources.flatMap((resource) => [
3857
+ `${resource.name} (${resource.kind})`,
3858
+ ...resource.recordKinds ? [` Observed record kinds: ${resource.recordKinds.join(", ") || "none"}`] : [],
3859
+ ...resource.recordSchemas?.flatMap((schema) => [
3860
+ ` Record attributes: ${schema.kind} (fields may be absent)`,
3861
+ ...schema.fields.map((field) => ` ${field.name}: ${field.type}`)
3862
+ ]) ?? [],
3863
+ ...resource.operations.map((operation) => ` ${operation.tool}${operation.target ? ` --target ${operation.target}` : ""}: ${operation.available ? "available" : `unavailable (${operation.reason})`}; scope: ${operation.scope}`),
3864
+ ...resource.relation ? [
3865
+ ` SQL relation: ${resource.relation.name}; connection: ${catalog.integrationAccountId}`,
3866
+ ...resource.relation.columns.map((column) => ` ${column.name}: ${column.type}${column.nullable ? " (nullable)" : ""}`)
3867
+ ] : []
3868
+ ]),
3869
+ ...catalog.warnings.map((warning) => `Warning: ${warning}`),
3870
+ ...result.nextCursor ? [`More: --cursor ${result.nextCursor}`] : [],
3871
+ "Resource keys are not record refs. Use search or normal index to find a record for get."
3872
+ ].join("\n");
3873
+ }
3850
3874
  if (!result.entries.length) return "No authorized records found.";
3851
3875
  const lines = [`Index: ${result.path}`];
3852
3876
  for (const entry of result.entries) {
@@ -4051,7 +4075,7 @@ ${result.issuer}`
4051
4075
  writeError(error, Boolean(options.json));
4052
4076
  }
4053
4077
  });
4054
- program2.command("index [path]").description("Browse authorized integration records").option("--organization <id>", "Assert configured organization").option("--depth <depth>", "Inventory depth (default 3)").option("--limit <limit>", "Maximum entries (1-200)").option("--cursor <cursor>", "Opaque pagination cursor").option("-j, --json", "Output shared DTO JSON").action(async (path, options) => {
4078
+ program2.command("index [path]").description("Browse authorized integration records").option("--organization <id>", "Assert configured organization").option("--depth <depth>", "Inventory depth (default 3)").option("--resources", "Inspect resources at an account path instead of listing records").option("--limit <limit>", "Maximum entries or resources (1-200)").option("--cursor <cursor>", "Opaque pagination cursor").option("-j, --json", "Output shared DTO JSON").action(async (path, options) => {
4055
4079
  try {
4056
4080
  const result = await commands.index({ ...options, path });
4057
4081
  writeResult(result, Boolean(options.json), renderIndex(result));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trillioncore/cli",
3
- "version": "1.0.0-next.1",
3
+ "version": "1.0.0-next.3",
4
4
  "description": "Trillioncore v1 CLI: sign in and read your authorized integration records",
5
5
  "type": "module",
6
6
  "license": "MIT",