@warmhub/cli 0.117.0 → 0.118.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.
Files changed (2) hide show
  1. package/dist/wh.js +196 -58
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -45312,7 +45312,7 @@ function createStreamingSubmissionHandle(input, deps) {
45312
45312
  // ../../packages/sdk-ts/package.json
45313
45313
  var package_default = {
45314
45314
  name: "@warmhub/sdk-ts",
45315
- version: "0.115.0",
45315
+ version: "0.116.0",
45316
45316
  private: false,
45317
45317
  type: "module",
45318
45318
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -46725,6 +46725,30 @@ class WarmHubClient {
46725
46725
  } catch (error51) {
46726
46726
  throw toWarmHubError(error51);
46727
46727
  }
46728
+ },
46729
+ pin: async (orgName, repoName, shape, fieldPath) => {
46730
+ try {
46731
+ return await this.trpc.repo.index.pin.mutate({
46732
+ orgName,
46733
+ repoName,
46734
+ shape,
46735
+ fieldPath
46736
+ });
46737
+ } catch (error51) {
46738
+ throw toWarmHubError(error51);
46739
+ }
46740
+ },
46741
+ unpin: async (orgName, repoName, shape, fieldPath) => {
46742
+ try {
46743
+ return await this.trpc.repo.index.unpin.mutate({
46744
+ orgName,
46745
+ repoName,
46746
+ shape,
46747
+ fieldPath
46748
+ });
46749
+ } catch (error51) {
46750
+ throw toWarmHubError(error51);
46751
+ }
46728
46752
  }
46729
46753
  }
46730
46754
  };
@@ -48509,6 +48533,12 @@ function generateSuggestions(code, message, context, errorCode) {
48509
48533
  }
48510
48534
  }
48511
48535
  if (code === "FIELD_NOT_INDEXABLE") {
48536
+ if (message.includes("field-not-declared")) {
48537
+ suggestions.push({
48538
+ action: "Declare the field path for indexing, then retry",
48539
+ command: "wh repo index pin <Shape> <field.path>"
48540
+ });
48541
+ }
48512
48542
  suggestions.push({
48513
48543
  action: "Inspect indexed field state for the repo",
48514
48544
  command: "wh repo describe --indexed-fields"
@@ -65029,6 +65059,70 @@ var VERIFY_VERB = {
65029
65059
  handler: handleVerify2
65030
65060
  };
65031
65061
 
65062
+ // ../../packages/warmhub-cli/src/domains/repo/index-pin.ts
65063
+ var PIN_USAGE = "Usage: wh repo index pin <Shape> <field.path> [org/repo]";
65064
+ var PIN_EXAMPLE = "wh repo index pin Person address.city acme/world";
65065
+ var UNPIN_USAGE = "Usage: wh repo index unpin <Shape> <field.path> [org/repo]";
65066
+ var UNPIN_EXAMPLE = "wh repo index unpin Person address.city acme/world";
65067
+ function parseIndexArgs(args, usage, example) {
65068
+ const [shape, fieldPath, repoRef] = args;
65069
+ if (!shape || !fieldPath) {
65070
+ usageError(usage, example);
65071
+ }
65072
+ return { shape, fieldPath, repoRef };
65073
+ }
65074
+ function renderPinResult(ctx, verb, result) {
65075
+ const c = ctx.colors;
65076
+ ctx.out(`${c.green}${verb}${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(result.fieldPath)}${c.reset} via ${escapeTerminalTextForDisplay(result.declaredByShape)}`);
65077
+ if (result.carryingShapes.length === 0) {
65078
+ ctx.out(` ${c.dim}no shape in this repo carries the path${c.reset}`);
65079
+ return;
65080
+ }
65081
+ const maxShape = result.carryingShapes.reduce((m, s) => Math.max(m, s.shape.length), 0);
65082
+ for (const carrying of result.carryingShapes) {
65083
+ ctx.out(` ${c.cyan}${escapeTerminalTextForDisplay(carrying.shape.padEnd(maxShape))}${c.reset} ${escapeTerminalTextForDisplay(carrying.markerState)}`);
65084
+ }
65085
+ }
65086
+ var handlePin = async (ctx, { args }) => {
65087
+ const { shape, fieldPath, repoRef } = parseIndexArgs(args, PIN_USAGE, PIN_EXAMPLE);
65088
+ const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx) ?? repoRef, ctx.config);
65089
+ const result = await ctx.client.repo.index.pin(org, repo2, shape, fieldPath);
65090
+ writeOutput(ctx, result, () => renderPinResult(ctx, "Declared", result));
65091
+ };
65092
+ var handleUnpin = async (ctx, { args }) => {
65093
+ const { shape, fieldPath, repoRef } = parseIndexArgs(args, UNPIN_USAGE, UNPIN_EXAMPLE);
65094
+ const { org, repo: repo2 } = parseOrgRepo(getRepoRef(ctx) ?? repoRef, ctx.config);
65095
+ const result = await ctx.client.repo.index.unpin(org, repo2, shape, fieldPath);
65096
+ writeOutput(ctx, result, () => renderPinResult(ctx, "Withdrew", result));
65097
+ };
65098
+ var INDEX_SUBDOMAIN = defineDomain({
65099
+ name: "index",
65100
+ summary: "Declare which field paths the typed field index carries",
65101
+ verbs: {
65102
+ pin: {
65103
+ summary: "Declare a field path for indexing",
65104
+ args: "<Shape> <field.path> [org/repo]",
65105
+ notes: [
65106
+ "The declaration is repository-wide: every shape carrying the path is backfilled, not just the one named here.",
65107
+ "The path is resolved through the shape’s effective contract, so a composite may name a property one of its composed shapes owns.",
65108
+ "Read `wh repo describe --indexed-fields` for readiness."
65109
+ ],
65110
+ examples: [PIN_EXAMPLE, "wh repo index pin Person address.city"],
65111
+ handler: handlePin
65112
+ },
65113
+ unpin: {
65114
+ summary: "Withdraw a field path from indexing",
65115
+ args: "<Shape> <field.path> [org/repo]",
65116
+ notes: [
65117
+ "Refuses while a stored View definition references the path, naming the Views.",
65118
+ "Rows are evicted asynchronously; predicates on the path fail immediately."
65119
+ ],
65120
+ examples: [UNPIN_EXAMPLE, "wh repo index unpin Person address.city"],
65121
+ handler: handleUnpin
65122
+ }
65123
+ }
65124
+ });
65125
+
65032
65126
  // ../../packages/warmhub-cli/src/domains/repo/lifecycle.ts
65033
65127
  var confirmFlags2 = {
65034
65128
  yes: flag.boolean({ short: "y", description: "Skip confirmation prompt" })
@@ -65146,6 +65240,100 @@ var handleList6 = async (ctx, { flags, args }) => {
65146
65240
  });
65147
65241
  };
65148
65242
 
65243
+ // ../../packages/warmhub-cli/src/domains/repo/indexed-fields-view.ts
65244
+ function stripShapeThingId(bucket) {
65245
+ return bucket.map(({ shapeThingId: _omit, ...rest }) => rest);
65246
+ }
65247
+ function toPublicIndexedFields(report) {
65248
+ return {
65249
+ building: stripShapeThingId(report.building),
65250
+ ready: stripShapeThingId(report.ready),
65251
+ failed: stripShapeThingId(report.failed),
65252
+ other: stripShapeThingId(report.other),
65253
+ declarations: report.declarations,
65254
+ consistency: report.consistency
65255
+ };
65256
+ }
65257
+ function stateColor(c, state) {
65258
+ switch (state) {
65259
+ case "ready":
65260
+ return c.green;
65261
+ case "building":
65262
+ return c.yellow;
65263
+ case "failed":
65264
+ return c.red;
65265
+ default:
65266
+ return c.dim;
65267
+ }
65268
+ }
65269
+ function renderDeclarations(out, c, view) {
65270
+ const { declarations, consistency } = view;
65271
+ if (declarations.length === 0) {
65272
+ out(`${c.bold}Declared Fields${c.reset} ${c.dim}none${c.reset}`);
65273
+ out(` ${c.dim}Declare one with \`wh repo index pin <Shape> <path>\`${c.reset}`);
65274
+ } else {
65275
+ out(`${c.bold}Declared Fields${c.reset} (${declarations.length})`);
65276
+ out("");
65277
+ const maxPath = declarations.reduce((m, d) => Math.max(m, d.fieldPath.length), 0);
65278
+ for (const declaration of declarations) {
65279
+ const pathLabel = escapeTerminalTextForDisplay(declaration.fieldPath.padEnd(maxPath));
65280
+ const readiness = declaration.ready ? "ready" : "not ready";
65281
+ const rc = declaration.ready ? c.green : c.yellow;
65282
+ const carriedBy = declaration.carrying.length > 0 ? declaration.carrying.map((m) => `${m.shapeName} (${m.state})`).join(", ") : "no carrying shape";
65283
+ out(` ${c.cyan}${pathLabel}${c.reset} ${rc}${readiness}${c.reset} ${c.dim}${escapeTerminalTextForDisplay(carriedBy)}${c.reset}`);
65284
+ if (declaration.declaredByShape) {
65285
+ out(` ${c.dim}pinned via ${escapeTerminalTextForDisplay(declaration.declaredByShape)}${c.reset}`);
65286
+ }
65287
+ }
65288
+ }
65289
+ out("");
65290
+ if (!consistency.consistent) {
65291
+ out(`${c.bold}${c.red}Index consistency${c.reset}`);
65292
+ for (const marker of consistency.undeclaredMarkers) {
65293
+ out(` ${c.red}undeclared${c.reset} ${c.cyan}${escapeTerminalTextForDisplay(marker.shapeName)}${c.reset} ${escapeTerminalTextForDisplay(marker.fieldPath)}`);
65294
+ }
65295
+ out("");
65296
+ }
65297
+ }
65298
+ function renderMarkers(out, c, view) {
65299
+ const allEntries = [
65300
+ ...view.building,
65301
+ ...view.ready,
65302
+ ...view.failed,
65303
+ ...view.other
65304
+ ];
65305
+ if (allEntries.length === 0) {
65306
+ out(`${c.bold}Indexed Fields${c.reset} ${c.dim}none${c.reset}`);
65307
+ return;
65308
+ }
65309
+ out(`${c.bold}Indexed Fields${c.reset} (${allEntries.length})`);
65310
+ out("");
65311
+ const maxShape = allEntries.reduce((m, e) => Math.max(m, e.shapeName.length), 0);
65312
+ const maxField = allEntries.reduce((m, e) => Math.max(m, e.fieldPath.length), 0);
65313
+ const maxState = allEntries.reduce((m, e) => Math.max(m, e.state.length), 0);
65314
+ for (const entry of allEntries) {
65315
+ const shapeLabel = escapeTerminalTextForDisplay(entry.shapeName.padEnd(maxShape));
65316
+ const fieldLabel = escapeTerminalTextForDisplay(entry.fieldPath.padEnd(maxField));
65317
+ const stateLabel = escapeTerminalTextForDisplay(entry.state.padEnd(maxState));
65318
+ const sc = stateColor(c, entry.state);
65319
+ let line = ` ${c.cyan}${shapeLabel}${c.reset} ${c.dim}${fieldLabel}${c.reset} ${sc}${stateLabel}${c.reset}`;
65320
+ if (entry.state === "building" && entry.backfillTotal != null && entry.backfillTotal > 0) {
65321
+ const pct = Math.round(entry.backfillDone / entry.backfillTotal * 100);
65322
+ line += ` ${c.dim}${entry.backfillDone}/${entry.backfillTotal} (${pct}%)${c.reset}`;
65323
+ } else if (entry.state === "building") {
65324
+ line += ` ${c.dim}${entry.backfillDone} rows${c.reset}`;
65325
+ } else if (entry.state === "failed" && entry.failureReason) {
65326
+ line += ` ${c.dim}${escapeTerminalTextForDisplay(entry.failureReason)}${c.reset}`;
65327
+ }
65328
+ out(line);
65329
+ }
65330
+ out("");
65331
+ }
65332
+ function renderIndexedFields(out, c, view) {
65333
+ renderDeclarations(out, c, view);
65334
+ renderMarkers(out, c, view);
65335
+ }
65336
+
65149
65337
  // ../../packages/warmhub-cli/src/domains/repo/manage.ts
65150
65338
  var repoRenameFlags = {
65151
65339
  "display-name": flag.string({
@@ -65240,15 +65428,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
65240
65428
  ...nameStrings(shapes).map((name) => [name, 0]),
65241
65429
  ...Object.entries(stats.byShape)
65242
65430
  ]);
65243
- function stripShapeThingId(bucket) {
65244
- return bucket.map(({ shapeThingId: _omit, ...rest }) => rest);
65245
- }
65246
- const indexedFieldsPublic = indexedFields ? {
65247
- building: stripShapeThingId(indexedFields.building),
65248
- ready: stripShapeThingId(indexedFields.ready),
65249
- failed: stripShapeThingId(indexedFields.failed),
65250
- other: stripShapeThingId(indexedFields.other)
65251
- } : null;
65431
+ const indexedFieldsPublic = indexedFields ? toPublicIndexedFields(indexedFields) : null;
65252
65432
  const payload = {
65253
65433
  org,
65254
65434
  repo: repo2,
@@ -65324,50 +65504,7 @@ var handleDescribe = async (ctx, { args, flags }) => {
65324
65504
  ctx.out("");
65325
65505
  }
65326
65506
  if (indexedFieldsPublic) {
65327
- const allEntries = [
65328
- ...indexedFieldsPublic.building,
65329
- ...indexedFieldsPublic.ready,
65330
- ...indexedFieldsPublic.failed,
65331
- ...indexedFieldsPublic.other
65332
- ];
65333
- if (allEntries.length === 0) {
65334
- ctx.out(`${c.bold}Indexed Fields${c.reset} ${c.dim}none${c.reset}`);
65335
- } else {
65336
- ctx.out(`${c.bold}Indexed Fields${c.reset} (${allEntries.length})`);
65337
- ctx.out("");
65338
- const stateColor = (state) => {
65339
- switch (state) {
65340
- case "ready":
65341
- return c.green;
65342
- case "building":
65343
- return c.yellow;
65344
- case "failed":
65345
- return c.red;
65346
- default:
65347
- return c.dim;
65348
- }
65349
- };
65350
- const maxShape = allEntries.reduce((m, e) => Math.max(m, e.shapeName.length), 0);
65351
- const maxField = allEntries.reduce((m, e) => Math.max(m, e.fieldPath.length), 0);
65352
- const maxState = allEntries.reduce((m, e) => Math.max(m, e.state.length), 0);
65353
- for (const entry of allEntries) {
65354
- const shapeLabel = escapeTerminalTextForDisplay(entry.shapeName.padEnd(maxShape));
65355
- const fieldLabel = escapeTerminalTextForDisplay(entry.fieldPath.padEnd(maxField));
65356
- const stateLabel = escapeTerminalTextForDisplay(entry.state.padEnd(maxState));
65357
- const sc = stateColor(entry.state);
65358
- let line = ` ${c.cyan}${shapeLabel}${c.reset} ${c.dim}${fieldLabel}${c.reset} ${sc}${stateLabel}${c.reset}`;
65359
- if (entry.state === "building" && entry.backfillTotal != null && entry.backfillTotal > 0) {
65360
- const pct = Math.round(entry.backfillDone / entry.backfillTotal * 100);
65361
- line += ` ${c.dim}${entry.backfillDone}/${entry.backfillTotal} (${pct}%)${c.reset}`;
65362
- } else if (entry.state === "building") {
65363
- line += ` ${c.dim}${entry.backfillDone} rows${c.reset}`;
65364
- } else if (entry.state === "failed" && entry.failureReason) {
65365
- line += ` ${c.dim}${escapeTerminalTextForDisplay(entry.failureReason)}${c.reset}`;
65366
- }
65367
- ctx.out(line);
65368
- }
65369
- ctx.out("");
65370
- }
65507
+ renderIndexedFields(ctx.out, c, indexedFieldsPublic);
65371
65508
  }
65372
65509
  });
65373
65510
  };
@@ -65565,7 +65702,8 @@ var REPO_DOMAIN = defineDomain({
65565
65702
  },
65566
65703
  subdomains: {
65567
65704
  checkpoint: CHECKPOINT_SUBDOMAIN,
65568
- content: CONTENT_SUBDOMAIN
65705
+ content: CONTENT_SUBDOMAIN,
65706
+ index: INDEX_SUBDOMAIN
65569
65707
  }
65570
65708
  });
65571
65709
 
@@ -69612,7 +69750,7 @@ function resolveLogLevel(flagLevel, env) {
69612
69750
  // package.json
69613
69751
  var package_default3 = {
69614
69752
  name: "@warmhub/cli",
69615
- version: "0.117.0",
69753
+ version: "0.118.0",
69616
69754
  private: false,
69617
69755
  type: "module",
69618
69756
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -70237,5 +70375,5 @@ process.exitCode = interceptedExitCode === undefined ? await runPreparedCli(laun
70237
70375
  version: package_default3.version
70238
70376
  }) : interceptedExitCode;
70239
70377
 
70240
- //# debugId=A07541AC8954FD7B64756E2164756E21
70241
- //# warmhub-cli-build-info {"cliVersion":"0.117.0","sdkVersion":"0.115.0"}
70378
+ //# debugId=E526A210005F6CCA64756E2164756E21
70379
+ //# warmhub-cli-build-info {"cliVersion":"0.118.0","sdkVersion":"0.116.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.117.0",
3
+ "version": "0.118.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",