@standards/cli 1.0.0-alpha.416 → 1.0.0-alpha.418

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/bin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
3
- import { t as discoverBundles } from "./discover-bundles-D5RNCkan.mjs";
3
+ import { t as discoverBundles } from "./discover-bundles-DPpEZVv0.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { styleText } from "node:util";
6
6
  import { BundleConflictError, StandardsRequestError, createTransport, syncBundle } from "@standards/client";
@@ -19,7 +19,7 @@ import { stdin, stdout } from "node:process";
19
19
  import { createInterface } from "node:readline/promises";
20
20
  import { homedir } from "node:os";
21
21
  import { isSafeSkillFilePath, skillFileText } from "@standards/constants";
22
- //#region src/output.ts
22
+ // src/output.ts
23
23
  const MAX_CELL_WIDTH = 50;
24
24
  function truncate(value, maxLength) {
25
25
  if (value.length <= maxLength) return value;
@@ -71,8 +71,7 @@ function formatOutput(data, format) {
71
71
  }
72
72
  process.stdout.write(`${formatTable(items)}\n`);
73
73
  }
74
- //#endregion
75
- //#region src/client.ts
74
+ // src/client.ts
76
75
  /** The CLI's transport: the profile's bearer key and tenant header over the shared HTTP transport. */
77
76
  function createClient(config) {
78
77
  return createTransport({
@@ -81,8 +80,7 @@ function createClient(config) {
81
80
  tenantId: config.tenantId
82
81
  });
83
82
  }
84
- //#endregion
85
- //#region src/commands/common.ts
83
+ // src/commands/common.ts
86
84
  function getGlobalOptions(cmd) {
87
85
  return cmd.optsWithGlobals();
88
86
  }
@@ -154,8 +152,7 @@ function requireConfirmation(yes, message) {
154
152
  function messageOf(error) {
155
153
  return error instanceof Error ? error.message : String(error);
156
154
  }
157
- //#endregion
158
- //#region src/commands/ai.ts
155
+ // src/commands/ai.ts
159
156
  const SCOPES = ["me", "workspace"];
160
157
  /** `GET /ai/usage` reads inclusive UTC days; anything else reaches the API as a 400. */
161
158
  const ISO_DAY = /^\d{4}-\d{2}-\d{2}$/u;
@@ -185,8 +182,7 @@ function registerAiCommand(program) {
185
182
  formatOutput(await getAppClientFromCommand(cmd).ai.wallet({}), getFormat(cmd));
186
183
  });
187
184
  }
188
- //#endregion
189
- //#region src/commands/auth.ts
185
+ // src/commands/auth.ts
190
186
  function registerAuthCommand(program) {
191
187
  program.command("auth").description("Inspect CLI authentication").command("whoami").description("Show current configuration and validate API key").action(async (_opts, cmd) => {
192
188
  const root = getGlobalOptions(cmd);
@@ -201,8 +197,7 @@ function registerAuthCommand(program) {
201
197
  if (Array.isArray(keys) && keys.length > 0) write(` Active keys: ${keys.filter((key) => !key.revokedAt).length}`);
202
198
  });
203
199
  }
204
- //#endregion
205
- //#region src/discovery/order-bundles.ts
200
+ // src/discovery/order-bundles.ts
206
201
  /**
207
202
  * Orders discovered bundles so each comes after the bundles it `uses`.
208
203
  * Bundles a `uses` names that were not discovered are already the host's concern.
@@ -223,8 +218,7 @@ async function orderByUses(discovered) {
223
218
  for (const entry of discovered) await visit(entry);
224
219
  return ordered;
225
220
  }
226
- //#endregion
227
- //#region src/commands/bundles.ts
221
+ // src/commands/bundles.ts
228
222
  const HASH_PREFIX_LENGTH = 7;
229
223
  function shortHash(hash) {
230
224
  return hash?.slice(0, HASH_PREFIX_LENGTH) ?? "";
@@ -322,8 +316,7 @@ function registerBundlesCommand(program) {
322
316
  console.info(`${name} removed`);
323
317
  }));
324
318
  }
325
- //#endregion
326
- //#region src/commands/connectors.ts
319
+ // src/commands/connectors.ts
327
320
  const PROVIDERS = Object.keys({
328
321
  github: true,
329
322
  slack: true,
@@ -398,8 +391,7 @@ function registerConnectorsCommand(program) {
398
391
  process.stdout.write(`${styleText("green", "✓")} Connector connection ${id} disconnected.\n`);
399
392
  });
400
393
  }
401
- //#endregion
402
- //#region src/drift/shared-state.ts
394
+ // src/drift/shared-state.ts
403
395
  async function readSchemaState(client) {
404
396
  const state = parseSchemaState(await client.schemaState.get({}));
405
397
  if (createHash("sha256").update(canonicalStringify(schemaStateSourcePayload(state.entries))).digest("hex") !== state.sourceFingerprint) throw new ValidationError("Invalid schema state: sourceFingerprint does not match deployed source", []);
@@ -408,8 +400,7 @@ async function readSchemaState(client) {
408
400
  function prettyCanonical(value) {
409
401
  return JSON.stringify(JSON.parse(canonicalStringify(value)), null, 2);
410
402
  }
411
- //#endregion
412
- //#region src/commands/diff.ts
403
+ // src/commands/diff.ts
413
404
  async function runDiffCommand(client) {
414
405
  try {
415
406
  const diff = diffSchemaState(await readSchemaState(client));
@@ -443,8 +434,7 @@ function registerDiffCommand(program) {
443
434
  process.exit(result.exitCode);
444
435
  });
445
436
  }
446
- //#endregion
447
- //#region src/commands/documents.ts
437
+ // src/commands/documents.ts
448
438
  /**
449
439
  * Human-readable table row for a pack file. `id` is kept (unlike other
450
440
  * dropped fields) because `remove-file <documentId> <fileId>` requires it —
@@ -517,8 +507,7 @@ function registerDocumentsCommand(program) {
517
507
  process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
518
508
  });
519
509
  }
520
- //#endregion
521
- //#region src/commands/embeddings.ts
510
+ // src/commands/embeddings.ts
522
511
  function registerEmbeddingsCommand(program) {
523
512
  program.command("embeddings").description("Maintain record and email embeddings").command("drain").description("Embed every pending record and email of the tenant").action(async (_opts, cmd) => {
524
513
  const tenant = requireTenant(cmd, "An embedding drain names its tenant explicitly. Pass \"--tenant <id>\".");
@@ -526,8 +515,7 @@ function registerEmbeddingsCommand(program) {
526
515
  process.stdout.write(`${styleText("green", "✓")} Embedding drain accepted for tenant ${tenant}.\n`);
527
516
  });
528
517
  }
529
- //#endregion
530
- //#region src/commands/folders.ts
518
+ // src/commands/folders.ts
531
519
  function registerFoldersCommand(program) {
532
520
  program.command("folders").description("Manage record drive folders").command("reconcile-paths").description("Create a folder tree on a record drive from paths").argument("<object>", "object name (e.g. contacts)").argument("<recordId>", "record ID owning the drive").option("--path <path>", "folder path to create (repeatable)", (val, acc) => {
533
521
  acc.push(val);
@@ -547,8 +535,7 @@ function registerFoldersCommand(program) {
547
535
  }), getFormat(cmd));
548
536
  });
549
537
  }
550
- //#endregion
551
- //#region src/commands/invitations.ts
538
+ // src/commands/invitations.ts
552
539
  /** Invitation ids are `randomUUID` server-side, so anything else is a caller mistake. */
553
540
  const INVITATION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
554
541
  /**
@@ -586,8 +573,7 @@ function registerInvitationsCommand(program) {
586
573
  formatOutput(await getAppClientFromCommand(cmd).tenantInvitations.revoke({ id: invitationId }), getFormat(cmd));
587
574
  });
588
575
  }
589
- //#endregion
590
- //#region src/commands/keys.ts
576
+ // src/commands/keys.ts
591
577
  async function resolveRoleId(client, name) {
592
578
  const match = (await client.permissions.listRoles({})).find((role) => role.name === name);
593
579
  if (!match) throw new Error(`Unknown role "${name}". Roles are listed in the app's People settings.`);
@@ -617,8 +603,7 @@ function registerKeysCommand(program) {
617
603
  process.stdout.write(`${styleText("green", "✓")} API key ${id} revoked.\n`);
618
604
  });
619
605
  }
620
- //#endregion
621
- //#region src/commands/mcp.ts
606
+ // src/commands/mcp.ts
622
607
  /** The auth types `POST /mcp-servers` accepts today — `oauth` is rejected by the API. */
623
608
  const AUTH_TYPES = ["none", "header"];
624
609
  /** Build the `auth` block the API expects, failing before the request when a header auth is incomplete. */
@@ -682,8 +667,7 @@ function registerMcpCommand(program) {
682
667
  process.stdout.write(`${styleText("green", "✓")} MCP server ${id} disconnected.\n`);
683
668
  });
684
669
  }
685
- //#endregion
686
- //#region src/commands/meetings.ts
670
+ // src/commands/meetings.ts
687
671
  const ORDERS = ["asc", "desc"];
688
672
  /** Reject a typo instead of letting it fall back to the API default silently. */
689
673
  function parseOrder(order) {
@@ -760,8 +744,7 @@ function registerMeetingsCommand(program) {
760
744
  process.stdout.write(`${styleText("green", "✓")} Meeting grants recompute accepted for tenant ${tenant}.\n`);
761
745
  });
762
746
  }
763
- //#endregion
764
- //#region src/commands/memory.ts
747
+ // src/commands/memory.ts
765
748
  function registerMemoryCommand(program) {
766
749
  program.command("memory").description("Maintain agent memory").command("backfill").description("Rebuild agent memory from the tenant's last 30 days of sessions and meetings").option("--yes", "backfill without confirmation").action(async (opts, cmd) => {
767
750
  if (!opts.yes) throw new ValidationError("A memory backfill spends model calls on the last 30 days of evidence. Re-run with \"--yes\" to confirm.", []);
@@ -770,8 +753,7 @@ function registerMemoryCommand(program) {
770
753
  process.stdout.write(`${styleText("green", "✓")} Memory backfill queued for tenant ${tenant}. It runs in the background — follow the server logs for progress.\n`);
771
754
  });
772
755
  }
773
- //#endregion
774
- //#region src/drift/reconciliation-prompt.ts
756
+ // src/drift/reconciliation-prompt.ts
775
757
  function renderReconciliationPrompt(state) {
776
758
  const lines = [
777
759
  "# Standards schema reconciliation",
@@ -786,8 +768,7 @@ function renderReconciliationPrompt(state) {
786
768
  for (const entry of changes) lines.push(`## ${entry.change} ${JSON.stringify(entry.address)}`, `Status: ${entry.status}${entry.status === "copy" ? " (retained)" : ""}`, "```json", prettyCanonical(entry.effective ?? entry.source), "```", "");
787
769
  return `${lines.join("\n").trimEnd()}\n`;
788
770
  }
789
- //#endregion
790
- //#region src/commands/pull.ts
771
+ // src/commands/pull.ts
791
772
  function registerPullCommand(program) {
792
773
  program.command("pull").description("Read deployed source vs shared runtime; excludes unbuilt local TypeScript").option("--json", "Emit canonical shared state JSON instead of guidance").action(async (opts, cmd) => {
793
774
  let code = 0;
@@ -801,15 +782,13 @@ function registerPullCommand(program) {
801
782
  process.exit(code);
802
783
  });
803
784
  }
804
- //#endregion
805
- //#region src/commands/quotas.ts
785
+ // src/commands/quotas.ts
806
786
  function registerQuotasCommand(program) {
807
787
  program.command("quotas").description("Inspect the tenant's remaining capacity").command("list").description("List one state per quota key (limit is null when nothing is enforced)").action(async (_opts, cmd) => {
808
788
  formatOutput(await getAppClientFromCommand(cmd).quotas.list({}), getFormat(cmd));
809
789
  });
810
790
  }
811
- //#endregion
812
- //#region src/commands/records.ts
791
+ // src/commands/records.ts
813
792
  function parseSortFlag(sort) {
814
793
  const [attribute, direction = "asc"] = sort.split(":");
815
794
  return [{
@@ -820,8 +799,8 @@ function parseSortFlag(sort) {
820
799
  /** Build the shared list/search request body from common query flags. */
821
800
  function buildQueryBody(opts) {
822
801
  const body = {};
823
- if (opts.limit) body.limit = Number(opts.limit);
824
- if (opts.offset) body.offset = Number(opts.offset);
802
+ if (opts.limit !== void 0) body.limit = parseCount("--limit", opts.limit);
803
+ if (opts.offset !== void 0) body.offset = parseCount("--offset", opts.offset);
825
804
  if (opts.sort) body.sorts = parseSortFlag(opts.sort);
826
805
  if (opts.filter) body.filters = JSON.parse(opts.filter);
827
806
  if (opts.fields !== void 0) body.fields = parseCsvList(opts.fields);
@@ -974,8 +953,7 @@ function registerRecordsCommand(program) {
974
953
  }), getFormat(cmd));
975
954
  });
976
955
  }
977
- //#endregion
978
- //#region src/config.ts
956
+ // src/config.ts
979
957
  const DEFAULT_API_URL = "http://localhost:4100/v1";
980
958
  const ENV_PROFILE_NAME = "sandbox";
981
959
  function getDefaultApiUrl() {
@@ -1092,8 +1070,7 @@ async function resolveCliConfig(options) {
1092
1070
  apiKey: process.env.STANDARDS_API_KEY
1093
1071
  };
1094
1072
  }
1095
- //#endregion
1096
- //#region src/commands/root.ts
1073
+ // src/commands/root.ts
1097
1074
  async function promptForMissingValue(label) {
1098
1075
  const rl = createInterface({
1099
1076
  input: stdin,
@@ -1143,8 +1120,7 @@ function registerRootCommands(program) {
1143
1120
  process.stdout.write(`${styleText("green", "✓")} Standards instance removed.\n`);
1144
1121
  });
1145
1122
  }
1146
- //#endregion
1147
- //#region src/commands/schema.ts
1123
+ // src/commands/schema.ts
1148
1124
  function registerSchemaCommand(program) {
1149
1125
  const schema = program.command("schema").description("Inspect schema objects and attributes");
1150
1126
  schema.command("list").description("List all schema objects").action(async (_opts, cmd) => {
@@ -1157,8 +1133,7 @@ function registerSchemaCommand(program) {
1157
1133
  formatOutput(await getAppClientFromCommand(cmd).schemaGroups.list({}), getFormat(cmd));
1158
1134
  });
1159
1135
  }
1160
- //#endregion
1161
- //#region src/commands/search.ts
1136
+ // src/commands/search.ts
1162
1137
  function registerSearchCommand(program) {
1163
1138
  program.command("search").description("Maintain the Standards search index").command("reindex").description("Rebuild the tenant search index beside the live one, then switch").option("--yes", "reindex without confirmation").option("--emails", "hand the tenant's stored emails back to the email indexer instead (nothing is cleared)").option("--after-id <emailId>", "with --emails, resume after the last email id a failed run reported").option("--rebuild", "with --emails and --yes, rebuild the mail search index from the stored mail instead (lifts a quarantine)").action(async (opts, cmd) => {
1164
1139
  if (opts.afterId !== void 0 && !opts.emails) throw new ValidationError("\"--after-id\" resumes an email reindex. Pass it with \"--emails\".", []);
@@ -1181,8 +1156,7 @@ function registerSearchCommand(program) {
1181
1156
  process.stdout.write(`${styleText("green", "✓")} Index rebuild accepted for tenant ${tenant}. Search keeps answering from the current index until the rebuilt one replaces it — follow the server logs for progress.\n`);
1182
1157
  });
1183
1158
  }
1184
- //#endregion
1185
- //#region src/commands/skills.ts
1159
+ // src/commands/skills.ts
1186
1160
  const SKILL_FILE = "SKILL.md";
1187
1161
  const DEFAULT_SEARCH_LIMIT = 20;
1188
1162
  /** A folder name: one path segment under the rule (`isSafeSkillFilePath`). */
@@ -1415,8 +1389,7 @@ function registerSkillsCommand(program) {
1415
1389
  await printAnswer(cmd, () => runSkillsRefresh(getAppClientFromCommand(cmd)));
1416
1390
  });
1417
1391
  }
1418
- //#endregion
1419
- //#region src/version.ts
1392
+ // src/version.ts
1420
1393
  /**
1421
1394
  * The installed package's version, read from its own manifest: `src/` and the
1422
1395
  * built `dist/` both sit one level under it, and npm always ships
@@ -1431,8 +1404,7 @@ function cliVersion() {
1431
1404
  const manifest = createRequire(import.meta.url)("../package.json");
1432
1405
  return typeof manifest === "object" && manifest !== null && "version" in manifest && typeof manifest.version === "string" ? manifest.version : "unknown";
1433
1406
  }
1434
- //#endregion
1435
- //#region src/program.ts
1407
+ // src/program.ts
1436
1408
  const PUBLIC_COMMANDS = /* @__PURE__ */ new Set([
1437
1409
  "login",
1438
1410
  "use",
@@ -1495,8 +1467,6 @@ async function runProgram(argv = process.argv) {
1495
1467
  process.exit(1);
1496
1468
  });
1497
1469
  }
1498
- //#endregion
1499
- //#region src/bin.ts
1470
+ // src/bin.ts
1500
1471
  await runProgram();
1501
- //#endregion
1502
1472
  export {};
@@ -5,7 +5,7 @@ import { existsSync } from "node:fs";
5
5
  import { glob } from "node:fs/promises";
6
6
  import { join, relative, resolve } from "node:path";
7
7
  import { createJiti } from "jiti";
8
- //#region src/discovery/discover-bundles.ts
8
+ // src/discovery/discover-bundles.ts
9
9
  const DEFAULT_PATTERNS = ["standards/bundles/*.ts"];
10
10
  const CONFIG_FILE = "standards.config.ts";
11
11
  function messageOf(error) {
@@ -64,5 +64,4 @@ async function discoverBundles(options = {}) {
64
64
  if (files.length > 0 && found.size === 0) throw new ValidationError(`No bundle found in ${files.length} file(s) matching ${patterns.join(", ")}`, []);
65
65
  return [...found.values()].sort((a, b) => a.bundle.name.localeCompare(b.bundle.name));
66
66
  }
67
- //#endregion
68
67
  export { discoverBundles as t };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  import { BundleBuilder, ObjectBuilderLike } from "@standards/schema";
3
- //#region src/discovery/define-config.d.ts
4
3
  /** What `standards.config.ts` declares. Every key is optional: the conventions apply without a file. */
5
4
  interface StandardsCliConfig {
6
5
  /** Glob pattern(s), relative to the project root, that locate the bundle files. */
@@ -8,8 +7,6 @@ interface StandardsCliConfig {
8
7
  }
9
8
  /** Types a `standards.config.ts` default export. */
10
9
  export declare function defineConfig(config: StandardsCliConfig): StandardsCliConfig;
11
- //#endregion
12
- //#region src/discovery/discover-bundles.d.ts
13
10
  type AnyBundle = BundleBuilder<string, readonly ObjectBuilderLike[]>;
14
11
  interface DiscoveredBundle {
15
12
  bundle: AnyBundle;
@@ -28,5 +25,4 @@ interface DiscoverBundlesOptions {
28
25
  * patterns match, that is a `BundleBuilder`. Files may hold anything else.
29
26
  */
30
27
  export declare function discoverBundles(options?: DiscoverBundlesOptions): Promise<DiscoveredBundle[]>;
31
- //#endregion
32
28
  export type { DiscoverBundlesOptions, DiscoveredBundle, StandardsCliConfig };
package/dist/index.mjs CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
3
- import { t as discoverBundles } from "./discover-bundles-D5RNCkan.mjs";
4
- //#region src/discovery/define-config.ts
3
+ import { t as discoverBundles } from "./discover-bundles-DPpEZVv0.mjs";
4
+ // src/discovery/define-config.ts
5
5
  /** Types a `standards.config.ts` default export. */
6
6
  function defineConfig(config) {
7
7
  return config;
8
8
  }
9
- //#endregion
10
9
  export { defineConfig, discoverBundles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standards/cli",
3
- "version": "1.0.0-alpha.416",
3
+ "version": "1.0.0-alpha.418",
4
4
  "description": "CLI tool to interact with Standards API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,20 +23,20 @@
23
23
  "node": ">=22"
24
24
  },
25
25
  "dependencies": {
26
+ "@standards/client": "1.0.0-alpha.418",
27
+ "@standards/constants": "1.0.0-alpha.418",
28
+ "@standards/schema": "1.0.0-alpha.418",
26
29
  "cli-table3": "^0.6.5",
27
30
  "commander": "^13.1.0",
28
- "jiti": "2.7.0",
29
- "@standards/client": "1.0.0-alpha.416",
30
- "@standards/constants": "1.0.0-alpha.416",
31
- "@standards/schema": "1.0.0-alpha.416"
31
+ "jiti": "2.7.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^25.6.0",
35
35
  "jsdom": "^25.0.1",
36
- "tsdown": "^0.23.0",
36
+ "tsdown": "^0.23.7",
37
37
  "typescript": "^5.6.3",
38
- "typescript7": "npm:typescript@^7.0.2",
39
- "vitest": "^5.0.5"
38
+ "typescript7": "npm:typescript@7.1.0-beta",
39
+ "vitest": "^5.1.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public",